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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
7a9d7924
Commit
7a9d7924
authored
Jan 31, 2015
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Fix simple request
parent
9a3f2b24
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/surface/call.c
+21
-26
21 additions, 26 deletions
src/core/surface/call.c
with
21 additions
and
26 deletions
src/core/surface/call.c
+
21
−
26
View file @
7a9d7924
...
@@ -66,7 +66,6 @@ typedef struct {
...
@@ -66,7 +66,6 @@ typedef struct {
size_t
msg_in_read_idx
;
size_t
msg_in_read_idx
;
grpc_byte_buffer
*
msg_in
;
grpc_byte_buffer
*
msg_in
;
gpr_uint8
got_status
;
void
*
finished_tag
;
void
*
finished_tag
;
}
legacy_state
;
}
legacy_state
;
...
@@ -134,7 +133,6 @@ struct grpc_call {
...
@@ -134,7 +133,6 @@ struct grpc_call {
gpr_uint8
have_alarm
;
gpr_uint8
have_alarm
;
gpr_uint8
read_closed
;
gpr_uint8
read_closed
;
gpr_uint8
stream_closed
;
gpr_uint8
stream_closed
;
gpr_uint8
got_status_code
;
gpr_uint8
sending
;
gpr_uint8
sending
;
gpr_uint8
num_completed_requests
;
gpr_uint8
num_completed_requests
;
gpr_uint8
need_more_data
;
gpr_uint8
need_more_data
;
...
@@ -337,6 +335,7 @@ static void get_final_status(grpc_call *call, grpc_recv_status_args args) {
...
@@ -337,6 +335,7 @@ static void get_final_status(grpc_call *call, grpc_recv_status_args args) {
for
(
i
=
0
;
i
<
STATUS_SOURCE_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
STATUS_SOURCE_COUNT
;
i
++
)
{
if
(
call
->
status
[
i
].
set
)
{
if
(
call
->
status
[
i
].
set
)
{
*
args
.
code
=
call
->
status
[
i
].
code
;
*
args
.
code
=
call
->
status
[
i
].
code
;
if
(
!
args
.
details
)
return
;
if
(
call
->
status
[
i
].
details
)
{
if
(
call
->
status
[
i
].
details
)
{
gpr_slice
details
=
call
->
status
[
i
].
details
->
slice
;
gpr_slice
details
=
call
->
status
[
i
].
details
->
slice
;
size_t
len
=
GPR_SLICE_LENGTH
(
details
);
size_t
len
=
GPR_SLICE_LENGTH
(
details
);
...
@@ -354,6 +353,7 @@ static void get_final_status(grpc_call *call, grpc_recv_status_args args) {
...
@@ -354,6 +353,7 @@ static void get_final_status(grpc_call *call, grpc_recv_status_args args) {
}
}
}
}
*
args
.
code
=
GRPC_STATUS_UNKNOWN
;
*
args
.
code
=
GRPC_STATUS_UNKNOWN
;
if
(
!
args
.
details
)
return
;
no_details:
no_details:
if
(
0
==
*
args
.
details_capacity
)
{
if
(
0
==
*
args
.
details_capacity
)
{
...
@@ -444,6 +444,8 @@ static send_action choose_send_action(grpc_call *call) {
...
@@ -444,6 +444,8 @@ static send_action choose_send_action(grpc_call *call) {
}
else
if
(
call
->
requests
[
GRPC_IOREQ_SEND_TRAILING_METADATA
].
set
!=
}
else
if
(
call
->
requests
[
GRPC_IOREQ_SEND_TRAILING_METADATA
].
set
!=
REQSET_EMPTY
&&
REQSET_EMPTY
&&
call
->
requests
[
GRPC_IOREQ_SEND_STATUS
].
set
!=
REQSET_EMPTY
)
{
call
->
requests
[
GRPC_IOREQ_SEND_STATUS
].
set
!=
REQSET_EMPTY
)
{
finish_ioreq_op
(
call
,
GRPC_IOREQ_SEND_TRAILING_METADATA
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_SEND_STATUS
,
GRPC_OP_OK
);
return
SEND_TRAILING_METADATA_AND_FINISH
;
return
SEND_TRAILING_METADATA_AND_FINISH
;
}
else
{
}
else
{
return
SEND_NOTHING
;
return
SEND_NOTHING
;
...
@@ -602,15 +604,14 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs,
...
@@ -602,15 +604,14 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs,
*
data
.
recv_message
=
grpc_bbq_pop
(
&
call
->
incoming_queue
);
*
data
.
recv_message
=
grpc_bbq_pop
(
&
call
->
incoming_queue
);
if
(
*
data
.
recv_message
)
{
if
(
*
data
.
recv_message
)
{
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_MESSAGE
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_MESSAGE
,
GRPC_OP_OK
);
}
else
if
(
call
->
stream_closed
)
{
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_CLOSE
,
GRPC_OP_OK
);
}
else
{
}
else
{
call
->
need_more_data
=
1
;
call
->
need_more_data
=
1
;
}
}
if
(
call
->
stream_closed
)
{
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_STATUS
,
GRPC_OP_OK
);
}
break
;
break
;
case
GRPC_IOREQ_RECV_STATUS
:
case
GRPC_IOREQ_RECV_STATUS
:
if
(
call
->
st
rea
m
_closed
)
{
if
(
call
->
rea
d
_closed
)
{
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_STATUS
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_STATUS
,
GRPC_OP_OK
);
}
}
break
;
break
;
...
@@ -760,23 +761,15 @@ grpc_call_error grpc_call_add_metadata(grpc_call *call, grpc_metadata *metadata,
...
@@ -760,23 +761,15 @@ grpc_call_error grpc_call_add_metadata(grpc_call *call, grpc_metadata *metadata,
return
GRPC_CALL_OK
;
return
GRPC_CALL_OK
;
}
}
static
void
maybe_finish_legacy
(
grpc_call
*
call
)
{
legacy_state
*
ls
=
get_legacy_state
(
call
);
if
(
ls
->
got_status
)
{
grpc_cq_end_finished
(
call
->
cq
,
ls
->
finished_tag
,
call
,
do_nothing
,
NULL
,
ls
->
status
,
ls
->
details
,
ls
->
trailing_md_in
.
metadata
,
ls
->
trailing_md_in
.
count
);
}
}
static
void
finish_status
(
grpc_call
*
call
,
grpc_op_error
status
,
static
void
finish_status
(
grpc_call
*
call
,
grpc_op_error
status
,
void
*
ignored
)
{
void
*
ignored
)
{
legacy_state
*
ls
;
legacy_state
*
ls
;
lock
(
call
);
lock
(
call
);
ls
=
get_legacy_state
(
call
);
ls
=
get_legacy_state
(
call
);
ls
->
got_status
=
1
;
grpc_cq_end_finished
(
call
->
cq
,
ls
->
finished_tag
,
call
,
do_nothing
,
NULL
,
maybe_finish_legacy
(
call
);
ls
->
status
,
ls
->
details
,
ls
->
trailing_md_in
.
metadata
,
ls
->
trailing_md_in
.
count
);
unlock
(
call
);
unlock
(
call
);
}
}
...
@@ -1028,14 +1021,19 @@ void grpc_call_set_deadline(grpc_call_element *elem, gpr_timespec deadline) {
...
@@ -1028,14 +1021,19 @@ void grpc_call_set_deadline(grpc_call_element *elem, gpr_timespec deadline) {
grpc_alarm_init
(
&
call
->
alarm
,
deadline
,
call_alarm
,
call
,
gpr_now
());
grpc_alarm_init
(
&
call
->
alarm
,
deadline
,
call_alarm
,
call
,
gpr_now
());
}
}
void
grpc_call_read_closed
(
grpc_call_element
*
elem
)
{
static
void
mark_read_closed
(
grpc_call
*
call
)
{
grpc_call
*
call
=
CALL_FROM_TOP_ELEM
(
elem
);
lock
(
call
);
GPR_ASSERT
(
!
call
->
read_closed
);
call
->
read_closed
=
1
;
call
->
read_closed
=
1
;
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_MESSAGE
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_MESSAGE
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_INITIAL_METADATA
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_INITIAL_METADATA
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_TRAILING_METADATA
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_TRAILING_METADATA
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_STATUS
,
GRPC_OP_OK
);
}
void
grpc_call_read_closed
(
grpc_call_element
*
elem
)
{
grpc_call
*
call
=
CALL_FROM_TOP_ELEM
(
elem
);
lock
(
call
);
GPR_ASSERT
(
!
call
->
read_closed
);
mark_read_closed
(
call
);
unlock
(
call
);
unlock
(
call
);
}
}
...
@@ -1044,14 +1042,11 @@ void grpc_call_stream_closed(grpc_call_element *elem) {
...
@@ -1044,14 +1042,11 @@ void grpc_call_stream_closed(grpc_call_element *elem) {
lock
(
call
);
lock
(
call
);
GPR_ASSERT
(
!
call
->
stream_closed
);
GPR_ASSERT
(
!
call
->
stream_closed
);
if
(
!
call
->
read_closed
)
{
if
(
!
call
->
read_closed
)
{
call
->
read_closed
=
1
;
mark_read_closed
(
call
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_MESSAGE
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_INITIAL_METADATA
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_TRAILING_METADATA
,
GRPC_OP_OK
);
}
}
call
->
stream_closed
=
1
;
call
->
stream_closed
=
1
;
if
(
grpc_bbq_empty
(
&
call
->
incoming_queue
))
{
if
(
grpc_bbq_empty
(
&
call
->
incoming_queue
))
{
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_
STATUS
,
GRPC_OP_OK
);
finish_ioreq_op
(
call
,
GRPC_IOREQ_RECV_
CLOSE
,
GRPC_OP_OK
);
}
}
unlock
(
call
);
unlock
(
call
);
grpc_call_internal_unref
(
call
,
0
);
grpc_call_internal_unref
(
call
,
0
);
...
...
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
sign in
to comment