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: DelayedStream should start() real stream immediately #7750

Merged
merged 3 commits into from Jan 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions core/src/main/java/io/grpc/internal/DelayedStream.java
Expand Up @@ -306,14 +306,11 @@ public void cancel(final Status reason) {
checkState(listener != null, "May only be called after start");
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
checkNotNull(reason, "reason");
boolean delegateToRealStream = true;
ClientStreamListener listenerToClose = null;
synchronized (this) {
// If realStream != null, then either setStream() or cancel() has been called
if (realStream == null) {
setRealStream(NoopClientStream.INSTANCE);
delegateToRealStream = false;
// If listener == null, then start() will later call listener with 'error'
listenerToClose = listener;
error = reason;
}
}
Expand All @@ -326,10 +323,8 @@ public void run() {
});
} else {
drainPendingCalls();
if (listenerToClose != null) {
// Note that listenerToClose is a DelayedStreamListener
listenerToClose.closed(reason, new Metadata());
}
// Note that listener is a DelayedStreamListener
listener.closed(reason, new Metadata());
}
}

Expand Down