mirror of https://github.com/grpc/grpc-java.git
okhttp: Remove finished stream even if a pending stream was started
Fixes #11053
This commit is contained in:
parent
097a46b761
commit
d21fe32bea
|
@ -953,8 +953,8 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
|
||||||
}
|
}
|
||||||
if (!startPendingStreams()) {
|
if (!startPendingStreams()) {
|
||||||
stopIfNecessary();
|
stopIfNecessary();
|
||||||
maybeClearInUse(stream);
|
|
||||||
}
|
}
|
||||||
|
maybeClearInUse(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2080,6 +2080,26 @@ public class OkHttpClientTransportTest {
|
||||||
assertEquals(MISCARRIED, listener3.rpcProgress);
|
assertEquals(MISCARRIED, listener3.rpcProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void finishedStreamRemovedFromInUseState() throws Exception {
|
||||||
|
initTransport();
|
||||||
|
setMaxConcurrentStreams(1);
|
||||||
|
final MockStreamListener listener = new MockStreamListener();
|
||||||
|
OkHttpClientStream stream =
|
||||||
|
clientTransport.newStream(method, new Metadata(), CallOptions.DEFAULT, tracers);
|
||||||
|
stream.start(listener);
|
||||||
|
OkHttpClientStream pendingStream =
|
||||||
|
clientTransport.newStream(method, new Metadata(), CallOptions.DEFAULT, tracers);
|
||||||
|
pendingStream.start(listener);
|
||||||
|
waitForStreamPending(1);
|
||||||
|
clientTransport.finishStream(stream.transportState().id(), Status.OK, PROCESSED,
|
||||||
|
false, null, null);
|
||||||
|
verify(transportListener).transportInUse(true);
|
||||||
|
clientTransport.finishStream(pendingStream.transportState().id(), Status.OK, PROCESSED,
|
||||||
|
false, null, null);
|
||||||
|
verify(transportListener).transportInUse(false);
|
||||||
|
}
|
||||||
|
|
||||||
private int activeStreamCount() {
|
private int activeStreamCount() {
|
||||||
return clientTransport.getActiveStreams().length;
|
return clientTransport.getActiveStreams().length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue