mirror of https://github.com/grpc/grpc-java.git
netty: fix transport spuriously in notInUse state
Previously, if two streams are added (but not active yet), then the transport is changed into inUse; after that, if one of them gets active and then closed and removed, then the transport will be changed into and staying at notInUse, although the other stream could later be active.
This commit is contained in:
parent
dafea0100a
commit
fe1583c9b4
|
|
@ -184,30 +184,28 @@ class NettyClientHandler extends AbstractNettyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamAdded(Http2Stream stream) {
|
||||
NettyClientHandler.this.lifecycleManager.notifyInUse(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamRemoved(Http2Stream stream) {
|
||||
if (connection().numActiveStreams() == 0) {
|
||||
NettyClientHandler.this.lifecycleManager.notifyInUse(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamActive(Http2Stream stream) {
|
||||
if (NettyClientHandler.this.keepAliveManager != null
|
||||
&& connection().numActiveStreams() == 1) {
|
||||
if (connection().numActiveStreams() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
NettyClientHandler.this.lifecycleManager.notifyInUse(true);
|
||||
|
||||
if (NettyClientHandler.this.keepAliveManager != null) {
|
||||
NettyClientHandler.this.keepAliveManager.onTransportActive();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamClosed(Http2Stream stream) {
|
||||
if (NettyClientHandler.this.keepAliveManager != null
|
||||
&& connection().numActiveStreams() == 0) {
|
||||
if (connection().numActiveStreams() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NettyClientHandler.this.lifecycleManager.notifyInUse(false);
|
||||
|
||||
if (NettyClientHandler.this.keepAliveManager != null) {
|
||||
NettyClientHandler.this.keepAliveManager.onTransportIdle();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue