Skip to content

Commit d07986d

Browse files
committed
Flush after body frame
Otherwise we fill up the Netty buffer and get stuck.
1 parent 3fa8f87 commit d07986d

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/main/java/com/rabbitmq/client/impl/NettyFrameHandlerFactory.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ public void writeFrame(Frame frame) throws IOException {
383383
private void doWriteFrame(Frame frame) throws IOException {
384384
ByteBuffer bbPayload = frame.getByteBufferPayload();
385385
if (bbPayload != null) {
386-
// Zero-copy path: write frame header, wrap the ByteBuffer body directly, write frame end
387386
int payloadSize = bbPayload.remaining();
388387
ByteBuf header = this.channel.alloc().buffer(7);
389388
header.writeByte(frame.getType());
@@ -396,8 +395,7 @@ private void doWriteFrame(Frame frame) throws IOException {
396395
end.writeByte(AMQP.FRAME_END);
397396

398397
ByteBuf composite = Unpooled.wrappedBuffer(header, body, end);
399-
// this is for basicPublish, the channel will be flushed later
400-
this.channel.write(composite, this.channel.voidPromise());
398+
this.channel.writeAndFlush(composite, this.channel.voidPromise());
401399
} else {
402400
ByteBuf bb = this.channel.alloc().buffer(frame.size());
403401
frame.writeToByteBuf(bb);

0 commit comments

Comments
 (0)