Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: always call StreamTracer.streamClosed() when stream is officially closed #4331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public final void close(Status status, Metadata trailers) {
Preconditions.checkNotNull(trailers, "trailers");
if (!outboundClosed) {
outboundClosed = true;
statsTraceCtx.streamClosed(status);
endOfMessages();
addStatusToTrailers(trailers, status);
// Safe to set without synchronization because access is tightly controlled.
Expand Down Expand Up @@ -336,6 +335,7 @@ private void closeListener(Status newStatus) {
statsTraceCtx.streamClosed(newStatus);
getTransportTracer().reportStreamClosed(false);
} else {
statsTraceCtx.streamClosed(closedStatus);
getTransportTracer().reportStreamClosed(closedStatus.isOk());
}
listenerClosed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,10 @@ public void basicStream() throws Exception {
trailers.put(asciiKey, "dupvalue");
trailers.put(binaryKey, "äbinarytrailers");
serverStream.close(status, trailers);
assertSame(status, serverStreamTracer1.getStatus());
assertNull(serverStreamTracer1.nextInboundEvent());
assertNull(serverStreamTracer1.nextOutboundEvent());
assertCodeEquals(Status.OK, serverStreamListener.status.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertSame(status, serverStreamTracer1.getStatus());
Status clientStreamStatus = clientStreamListener.status.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
Metadata clientStreamTrailers =
clientStreamListener.trailers.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
Expand Down