Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
5f5f470b
Commit
5f5f470b
authored
8 years ago
by
Craig Tiller
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #8930 from ctiller/fixit19
Make TCP error messages more descriptive
parents
307ee650
db25f083
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/lib/iomgr/tcp_posix.c
+15
-6
15 additions, 6 deletions
src/core/lib/iomgr/tcp_posix.c
with
15 additions
and
6 deletions
src/core/lib/iomgr/tcp_posix.c
+
15
−
6
View file @
5f5f470b
...
@@ -107,6 +107,12 @@ typedef struct {
...
@@ -107,6 +107,12 @@ typedef struct {
grpc_resource_user_slice_allocator
slice_allocator
;
grpc_resource_user_slice_allocator
slice_allocator
;
}
grpc_tcp
;
}
grpc_tcp
;
static
grpc_error
*
tcp_annotate_error
(
grpc_error
*
src_error
,
grpc_tcp
*
tcp
)
{
return
grpc_error_set_str
(
grpc_error_set_int
(
src_error
,
GRPC_ERROR_INT_FD
,
tcp
->
fd
),
GRPC_ERROR_STR_TARGET_ADDRESS
,
tcp
->
peer_string
);
}
static
void
tcp_handle_read
(
grpc_exec_ctx
*
exec_ctx
,
void
*
arg
/* grpc_tcp */
,
static
void
tcp_handle_read
(
grpc_exec_ctx
*
exec_ctx
,
void
*
arg
/* grpc_tcp */
,
grpc_error
*
error
);
grpc_error
*
error
);
static
void
tcp_handle_write
(
grpc_exec_ctx
*
exec_ctx
,
void
*
arg
/* grpc_tcp */
,
static
void
tcp_handle_write
(
grpc_exec_ctx
*
exec_ctx
,
void
*
arg
/* grpc_tcp */
,
...
@@ -230,13 +236,15 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
...
@@ -230,13 +236,15 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
grpc_fd_notify_on_read
(
exec_ctx
,
tcp
->
em_fd
,
&
tcp
->
read_closure
);
grpc_fd_notify_on_read
(
exec_ctx
,
tcp
->
em_fd
,
&
tcp
->
read_closure
);
}
else
{
}
else
{
grpc_slice_buffer_reset_and_unref
(
tcp
->
incoming_buffer
);
grpc_slice_buffer_reset_and_unref
(
tcp
->
incoming_buffer
);
call_read_cb
(
exec_ctx
,
tcp
,
GRPC_OS_ERROR
(
errno
,
"recvmsg"
));
call_read_cb
(
exec_ctx
,
tcp
,
tcp_annotate_error
(
GRPC_OS_ERROR
(
errno
,
"recvmsg"
),
tcp
));
TCP_UNREF
(
exec_ctx
,
tcp
,
"read"
);
TCP_UNREF
(
exec_ctx
,
tcp
,
"read"
);
}
}
}
else
if
(
read_bytes
==
0
)
{
}
else
if
(
read_bytes
==
0
)
{
/* 0 read size ==> end of stream */
/* 0 read size ==> end of stream */
grpc_slice_buffer_reset_and_unref
(
tcp
->
incoming_buffer
);
grpc_slice_buffer_reset_and_unref
(
tcp
->
incoming_buffer
);
call_read_cb
(
exec_ctx
,
tcp
,
GRPC_ERROR_CREATE
(
"Socket closed"
));
call_read_cb
(
exec_ctx
,
tcp
,
tcp_annotate_error
(
GRPC_ERROR_CREATE
(
"Socket closed"
),
tcp
));
TCP_UNREF
(
exec_ctx
,
tcp
,
"read"
);
TCP_UNREF
(
exec_ctx
,
tcp
,
"read"
);
}
else
{
}
else
{
GPR_ASSERT
((
size_t
)
read_bytes
<=
tcp
->
incoming_buffer
->
length
);
GPR_ASSERT
((
size_t
)
read_bytes
<=
tcp
->
incoming_buffer
->
length
);
...
@@ -366,7 +374,7 @@ static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
...
@@ -366,7 +374,7 @@ static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
tcp
->
outgoing_byte_idx
=
unwind_byte_idx
;
tcp
->
outgoing_byte_idx
=
unwind_byte_idx
;
return
false
;
return
false
;
}
else
{
}
else
{
*
error
=
GRPC_OS_ERROR
(
errno
,
"sendmsg"
);
*
error
=
tcp_annotate_error
(
GRPC_OS_ERROR
(
errno
,
"sendmsg"
)
,
tcp
)
;
return
true
;
return
true
;
}
}
}
}
...
@@ -447,9 +455,10 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
...
@@ -447,9 +455,10 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
if
(
buf
->
length
==
0
)
{
if
(
buf
->
length
==
0
)
{
GPR_TIMER_END
(
"tcp_write"
,
0
);
GPR_TIMER_END
(
"tcp_write"
,
0
);
grpc_exec_ctx_sched
(
exec_ctx
,
cb
,
grpc_fd_is_shutdown
(
tcp
->
em_fd
)
grpc_exec_ctx_sched
(
exec_ctx
,
cb
,
?
GRPC_ERROR_CREATE
(
"EOF"
)
grpc_fd_is_shutdown
(
tcp
->
em_fd
)
:
GRPC_ERROR_NONE
,
?
tcp_annotate_error
(
GRPC_ERROR_CREATE
(
"EOF"
),
tcp
)
:
GRPC_ERROR_NONE
,
NULL
);
NULL
);
return
;
return
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment