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
c68eb060
Commit
c68eb060
authored
9 years ago
by
Makarand Dharmapurikar
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix to work with empty messages
parent
3c62c555
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/ext/transport/cronet/transport/cronet_transport.c
+16
-4
16 additions, 4 deletions
src/core/ext/transport/cronet/transport/cronet_transport.c
with
16 additions
and
4 deletions
src/core/ext/transport/cronet/transport/cronet_transport.c
+
16
−
4
View file @
c68eb060
...
@@ -218,8 +218,11 @@ static void on_write_completed(cronet_bidirectional_stream *stream,
...
@@ -218,8 +218,11 @@ static void on_write_completed(cronet_bidirectional_stream *stream,
static
void
process_recv_message
(
stream_obj
*
s
,
const
uint8_t
*
recv_data
)
{
static
void
process_recv_message
(
stream_obj
*
s
,
const
uint8_t
*
recv_data
)
{
gpr_slice
read_data_slice
=
gpr_slice_malloc
((
uint32_t
)
s
->
total_read_bytes
);
gpr_slice
read_data_slice
=
gpr_slice_malloc
((
uint32_t
)
s
->
total_read_bytes
);
uint8_t
*
dst_p
=
GPR_SLICE_START_PTR
(
read_data_slice
);
uint8_t
*
dst_p
=
GPR_SLICE_START_PTR
(
read_data_slice
);
memcpy
(
dst_p
,
recv_data
,
(
size_t
)
s
->
total_read_bytes
);
if
(
s
->
total_read_bytes
>
0
)
{
gpr_slice_buffer_add
(
&
s
->
read_slice_buffer
,
read_data_slice
);
// Only copy if there is non-zero number of bytes
memcpy
(
dst_p
,
recv_data
,
(
size_t
)
s
->
total_read_bytes
);
gpr_slice_buffer_add
(
&
s
->
read_slice_buffer
,
read_data_slice
);
}
grpc_slice_buffer_stream_init
(
&
s
->
sbs
,
&
s
->
read_slice_buffer
,
0
);
grpc_slice_buffer_stream_init
(
&
s
->
sbs
,
&
s
->
read_slice_buffer
,
0
);
*
s
->
recv_message
=
(
grpc_byte_buffer
*
)
&
s
->
sbs
;
*
s
->
recv_message
=
(
grpc_byte_buffer
*
)
&
s
->
sbs
;
}
}
...
@@ -347,8 +350,17 @@ static void next_recv_step(stream_obj *s, enum e_caller caller) {
...
@@ -347,8 +350,17 @@ static void next_recv_step(stream_obj *s, enum e_caller caller) {
if
(
grpc_cronet_trace
)
{
if
(
grpc_cronet_trace
)
{
gpr_log
(
GPR_DEBUG
,
"R: cronet_bidirectional_stream_read()"
);
gpr_log
(
GPR_DEBUG
,
"R: cronet_bidirectional_stream_read()"
);
}
}
cronet_bidirectional_stream_read
(
s
->
cbs
,
(
char
*
)
s
->
read_buffer
,
if
(
s
->
remaining_read_bytes
>
0
)
{
s
->
remaining_read_bytes
);
cronet_bidirectional_stream_read
(
s
->
cbs
,
(
char
*
)
s
->
read_buffer
,
s
->
remaining_read_bytes
);
}
else
{
// Calling the closing callback directly since this is a 0 byte read
// for an empty message.
process_recv_message
(
s
,
NULL
);
enqueue_callbacks
(
s
->
callback_list
[
CB_RECV_MESSAGE
]);
invoke_closing_callback
(
s
);
set_recv_state
(
s
,
CRONET_RECV_CLOSED
);
}
}
}
}
}
break
;
break
;
...
...
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