mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-11-30 00:56:50 +00:00
Fix flaky replaceConnectionAfterGoAway
Make sure that the pipeline modification finishes before we write and flush the GOAWAY
This commit is contained in:
1 parent
21be842303
commit
cc487aa2ac
1 file changed
+12
-10
+12
-10
@@ -203,16 +203,18 @@ class PooledH2ConnectionFactoryTest {
|
||||
/// A future that completes once the factory has seen a GOAWAY on `connection`
|
||||
private static CompletableFuture<Void> goAwayRead(final Channel connection) {
|
||||
final CompletableFuture<Void> goAwayRead = new CompletableFuture<>();
|
||||
connection.pipeline().addAfter(connection.pipeline().context(Http2MultiplexHandler.class).name(), null,
|
||||
new ChannelInboundHandlerAdapter() {
|
||||
@Override
|
||||
public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
|
||||
ctx.fireChannelRead(msg);
|
||||
if (msg instanceof Http2GoAwayFrame) {
|
||||
goAwayRead.complete(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
connection.eventLoop().submit(() -> connection.pipeline()
|
||||
.addAfter(connection.pipeline().context(Http2MultiplexHandler.class).name(), null,
|
||||
new ChannelInboundHandlerAdapter() {
|
||||
@Override
|
||||
public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
|
||||
ctx.fireChannelRead(msg);
|
||||
if (msg instanceof Http2GoAwayFrame) {
|
||||
goAwayRead.complete(null);
|
||||
}
|
||||
}
|
||||
}))
|
||||
.syncUninterruptibly();
|
||||
return goAwayRead;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user