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
1a47fd02
Commit
1a47fd02
authored
8 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
lazy initialize streamingResponseCallFinishedTcs
parent
d92b795b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/csharp/Grpc.Core/Internal/AsyncCall.cs
+9
-8
9 additions, 8 deletions
src/csharp/Grpc.Core/Internal/AsyncCall.cs
src/csharp/Grpc.Core/Internal/ClientResponseStream.cs
+1
-1
1 addition, 1 deletion
src/csharp/Grpc.Core/Internal/ClientResponseStream.cs
with
10 additions
and
9 deletions
src/csharp/Grpc.Core/Internal/AsyncCall.cs
+
9
−
8
View file @
1a47fd02
...
...
@@ -52,9 +52,8 @@ namespace Grpc.Core.Internal
// Completion of a pending unary response if not null.
TaskCompletionSource
<
TResponse
>
unaryResponseTcs
;
// TODO(jtattermusch): this field doesn't need to be initialized for unary response calls.
// Indicates that response streaming call has finished.
TaskCompletionSource
<
object
>
streamingCallFinishedTcs
=
new
TaskCompletionSource
<
object
>();
// Completion of a streaming response call if not null.
TaskCompletionSource
<
object
>
streamingResponseCallFinishedTcs
;
// TODO(jtattermusch): this field could be lazy-initialized (only if someone requests the response headers).
// Response headers set here once received.
...
...
@@ -198,6 +197,7 @@ namespace Grpc.Core.Internal
byte
[]
payload
=
UnsafeSerialize
(
msg
);
streamingResponseCallFinishedTcs
=
new
TaskCompletionSource
<
object
>();
using
(
var
metadataArray
=
MetadataArraySafeHandle
.
Create
(
details
.
Options
.
Headers
))
{
call
.
StartServerStreaming
(
HandleFinished
,
payload
,
metadataArray
,
GetWriteFlagsForCall
());
...
...
@@ -219,6 +219,7 @@ namespace Grpc.Core.Internal
Initialize
(
details
.
Channel
.
CompletionQueue
);
streamingResponseCallFinishedTcs
=
new
TaskCompletionSource
<
object
>();
using
(
var
metadataArray
=
MetadataArraySafeHandle
.
Create
(
details
.
Options
.
Headers
))
{
call
.
StartDuplexStreaming
(
HandleFinished
,
metadataArray
);
...
...
@@ -276,13 +277,13 @@ namespace Grpc.Core.Internal
}
/// <summary>
/// Get the task that completes once if streaming call finishes with ok status and throws RpcException with given status otherwise.
/// Get the task that completes once if streaming
response
call finishes with ok status and throws RpcException with given status otherwise.
/// </summary>
public
Task
StreamingCallFinishedTask
public
Task
Streaming
Response
CallFinishedTask
{
get
{
return
streamingCallFinishedTcs
.
Task
;
return
streaming
Response
CallFinishedTcs
.
Task
;
}
}
...
...
@@ -529,11 +530,11 @@ namespace Grpc.Core.Internal
var
status
=
receivedStatus
.
Status
;
if
(
status
.
StatusCode
!=
StatusCode
.
OK
)
{
streamingCallFinishedTcs
.
SetException
(
new
RpcException
(
status
));
streaming
Response
CallFinishedTcs
.
SetException
(
new
RpcException
(
status
));
return
;
}
streamingCallFinishedTcs
.
SetResult
(
null
);
streaming
Response
CallFinishedTcs
.
SetResult
(
null
);
}
}
}
This diff is collapsed.
Click to expand it.
src/csharp/Grpc.Core/Internal/ClientResponseStream.cs
+
1
−
1
View file @
1a47fd02
...
...
@@ -73,7 +73,7 @@ namespace Grpc.Core.Internal
if
(
result
==
null
)
{
await
call
.
StreamingCallFinishedTask
.
ConfigureAwait
(
false
);
await
call
.
Streaming
Response
CallFinishedTask
.
ConfigureAwait
(
false
);
return
false
;
}
return
true
;
...
...
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