Skip to content

Commit 7b33450

Browse files
authored
BugFix: connection can't send data while http async stream write empty data. (#146)
- At content-length mode, invoking WriteDone of http async stream will write empty data to connection so that TcpClientConnection canculate wrong io_msgs_ size.
1 parent 608ac95 commit 7b33450

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

trpc/stream/http/async/stream.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ Future<> HttpAsyncStream::PushSendMessage(HttpStreamFramePtr&& msg) {
4848
if (IsStateTerminate()) {
4949
Stop();
5050
}
51+
// If got empty buffer, there is no need to write to connection.
52+
// Maybe caused by invoking `WriteDone` at content-length mode.
53+
if (out.ByteSize() == 0) {
54+
return MakeReadyFuture<>();
55+
}
5156
return AsyncWrite(std::move(out));
5257
}
5358

0 commit comments

Comments
 (0)