Skip to content

Commit ed182c9

Browse files
authored
Shutdown output after Ping frame is sent by Http3ClientFrameCodec (#15524)
1 parent d2c0478 commit ed182c9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h3/Http3ClientFrameCodec.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,13 @@ protected void initRequestStream(QuicStreamChannel ch) {
158158
header.set(PseudoHeaderName.SCHEME.value(), HttpConstants.HTTPS);
159159
header.set(Constants.TRI_PING, "0");
160160

161-
streamChannel.write(new DefaultHttp3HeadersFrame(header));
162-
streamChannel.shutdownOutput();
161+
ChannelFuture pingSentFuture =
162+
streamChannel.write(new DefaultHttp3HeadersFrame(header), streamChannel.newPromise());
163+
if (pingSentFuture.isDone()) {
164+
streamChannel.shutdownOutput();
165+
} else {
166+
pingSentFuture.addListener((ChannelFutureListener) f -> streamChannel.shutdownOutput());
167+
}
163168
} else {
164169
LOGGER.warn(TRANSPORT_FAILED_RECONNECT, "Failed to send ping frame", future.cause());
165170
}

0 commit comments

Comments
 (0)