Skip to content
Open
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 @@ -934,6 +934,10 @@ boolean isSidecarReady() {
return observer != null && observer.isReady();
}

private boolean isUpstreamReady() {
return method.getType().clientSendsOneMessage() || super.isReady();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in isUpstreamReady returning true always for any unary or serverstreaming call. I'd expect this to return false after the call has been half closed.

It's less likely to matter because for these cases the call doesn't respect isReady anyways, but we should try to be semantically correct.

}

@Override
public boolean isReady() {
if (passThroughMode.get()) {
Expand Down Expand Up @@ -1193,7 +1197,7 @@ private void handleRequestBodyResponse(BodyResponse bodyResponse) {
boolean sendImmediately = false;
synchronized (streamLock) {
sidestreamToUpstreamWindow -= body.size();
if (pendingUpstreamBodyMessages.isEmpty() && super.isReady()) {
if (pendingUpstreamBodyMessages.isEmpty() && isUpstreamReady()) {
sendImmediately = true;
accumulatedWindowUpdateSidestreamToUpstream += body.size();
} else {
Expand Down Expand Up @@ -1307,7 +1311,7 @@ void drainPendingUpstreamBodyMessages() {
ByteString body = null;
boolean triggerHalfClose = false;
synchronized (streamLock) {
if (!pendingUpstreamBodyMessages.isEmpty() && super.isReady()) {
if (!pendingUpstreamBodyMessages.isEmpty() && isUpstreamReady()) {
body = pendingUpstreamBodyMessages.poll();
accumulatedWindowUpdateSidestreamToUpstream += body.size();
if (pendingUpstreamBodyMessages.isEmpty()
Expand Down Expand Up @@ -1366,16 +1370,16 @@ private void drainPendingDrainingMessages() {
boolean triggerHalfClose = false;

synchronized (streamLock) {
if (!pendingUpstreamBodyMessages.isEmpty() && super.isReady()) {
if (!pendingUpstreamBodyMessages.isEmpty() && isUpstreamReady()) {
msg = pendingUpstreamBodyMessages.poll();
isMutated = true;
} else if (pendingUpstreamBodyMessages.isEmpty()
&& !pendingRequestBodyMessages.isEmpty() && super.isReady()) {
&& !pendingRequestBodyMessages.isEmpty() && isUpstreamReady()) {
msg = pendingRequestBodyMessages.poll();
isMutated = true;
} else if (pendingUpstreamBodyMessages.isEmpty()
&& pendingRequestBodyMessages.isEmpty()
&& !pendingDrainingMessages.isEmpty() && super.isReady()) {
&& !pendingDrainingMessages.isEmpty() && isUpstreamReady()) {
msg = pendingDrainingMessages.poll();
isMutated = false;
}
Expand Down
Loading
Loading