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
edb1d616
Commit
edb1d616
authored
9 years ago
by
David G. Quintas
Browse files
Options
Downloads
Plain Diff
Merge pull request #2890 from yang-g/client_context
client code clean up
parents
8d428f1e
37ce034d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/grpc++/client_context.h
+0
-4
0 additions, 4 deletions
include/grpc++/client_context.h
src/cpp/client/channel.cc
+19
-13
19 additions, 13 deletions
src/cpp/client/channel.cc
src/cpp/client/client_context.cc
+0
-9
0 additions, 9 deletions
src/cpp/client/client_context.cc
with
19 additions
and
26 deletions
include/grpc++/client_context.h
+
0
−
4
View file @
edb1d616
...
...
@@ -218,15 +218,11 @@ class ClientContext {
void
set_call
(
grpc_call
*
call
,
const
std
::
shared_ptr
<
ChannelInterface
>&
channel
);
grpc_completion_queue
*
cq
()
{
return
cq_
;
}
void
set_cq
(
grpc_completion_queue
*
cq
)
{
cq_
=
cq
;
}
grpc
::
string
authority
()
{
return
authority_
;
}
bool
initial_metadata_received_
;
std
::
shared_ptr
<
ChannelInterface
>
channel_
;
grpc_call
*
call_
;
grpc_completion_queue
*
cq_
;
gpr_timespec
deadline_
;
grpc
::
string
authority_
;
std
::
shared_ptr
<
Credentials
>
creds_
;
...
...
This diff is collapsed.
Click to expand it.
src/cpp/client/channel.cc
+
19
−
13
View file @
edb1d616
...
...
@@ -61,19 +61,25 @@ Channel::~Channel() { grpc_channel_destroy(c_channel_); }
Call
Channel
::
CreateCall
(
const
RpcMethod
&
method
,
ClientContext
*
context
,
CompletionQueue
*
cq
)
{
const
char
*
host_str
=
host_
.
empty
()
?
NULL
:
host_
.
c_str
();
auto
c_call
=
method
.
channel_tag
()
&&
context
->
authority
().
empty
()
?
grpc_channel_create_registered_call
(
c_channel_
,
context
->
propagate_from_call_
,
context
->
propagation_options_
.
c_bitmask
(),
cq
->
cq
(),
method
.
channel_tag
(),
context
->
raw_deadline
())
:
grpc_channel_create_call
(
c_channel_
,
context
->
propagate_from_call_
,
context
->
propagation_options_
.
c_bitmask
(),
cq
->
cq
(),
method
.
name
(),
context
->
authority
().
empty
()
?
host_str
:
context
->
authority
().
c_str
(),
context
->
raw_deadline
());
const
bool
kRegistered
=
method
.
channel_tag
()
&&
context
->
authority
().
empty
();
grpc_call
*
c_call
=
NULL
;
if
(
kRegistered
)
{
c_call
=
grpc_channel_create_registered_call
(
c_channel_
,
context
->
propagate_from_call_
,
context
->
propagation_options_
.
c_bitmask
(),
cq
->
cq
(),
method
.
channel_tag
(),
context
->
raw_deadline
());
}
else
{
const
char
*
host_str
=
NULL
;
if
(
!
context
->
authority
().
empty
())
{
host_str
=
context
->
authority
().
c_str
();
}
else
if
(
!
host_
.
empty
())
{
host_str
=
host_
.
c_str
();
}
c_call
=
grpc_channel_create_call
(
c_channel_
,
context
->
propagate_from_call_
,
context
->
propagation_options_
.
c_bitmask
(),
cq
->
cq
(),
method
.
name
(),
host_str
,
context
->
raw_deadline
());
}
grpc_census_call_set_context
(
c_call
,
context
->
census_context
());
GRPC_TIMER_MARK
(
GRPC_PTAG_CPP_CALL_CREATED
,
c_call
);
context
->
set_call
(
c_call
,
shared_from_this
());
...
...
This diff is collapsed.
Click to expand it.
src/cpp/client/client_context.cc
+
0
−
9
View file @
edb1d616
...
...
@@ -48,7 +48,6 @@ namespace grpc {
ClientContext
::
ClientContext
()
:
initial_metadata_received_
(
false
),
call_
(
nullptr
),
cq_
(
nullptr
),
deadline_
(
gpr_inf_future
(
GPR_CLOCK_REALTIME
)),
propagate_from_call_
(
nullptr
)
{}
...
...
@@ -56,14 +55,6 @@ ClientContext::~ClientContext() {
if
(
call_
)
{
grpc_call_destroy
(
call_
);
}
if
(
cq_
)
{
// Drain cq_.
grpc_completion_queue_shutdown
(
cq_
);
while
(
grpc_completion_queue_next
(
cq_
,
gpr_inf_future
(
GPR_CLOCK_REALTIME
))
.
type
!=
GRPC_QUEUE_SHUTDOWN
)
;
grpc_completion_queue_destroy
(
cq_
);
}
}
std
::
unique_ptr
<
ClientContext
>
ClientContext
::
FromServerContext
(
...
...
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