X Tutup
Skip to content

Commit 3f0ca2f

Browse files
committed
Send end of stream properly
1 parent 2bff259 commit 3f0ca2f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/com/github/dockerjava/netty/InvocationBuilder.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import io.netty.channel.Channel;
55
import io.netty.channel.ChannelFuture;
66
import io.netty.channel.ChannelFutureListener;
7+
import io.netty.channel.socket.DuplexChannel;
8+
import io.netty.channel.socket.SocketChannel;
79
import io.netty.handler.codec.http.DefaultFullHttpRequest;
810
import io.netty.handler.codec.http.DefaultHttpRequest;
911
import io.netty.handler.codec.http.FullHttpRequest;
@@ -262,6 +264,12 @@ public void run() {
262264
channel.writeAndFlush(Unpooled.copiedBuffer(buffer, 0, read));
263265
}
264266

267+
// we close the writing side of the socket, but keep the read side open to transfer stdout/stderr
268+
// unfortunately, shutdownOutput is not supported by io.netty.channel.epoll.EpollDomainSocketChannel
269+
if (channel instanceof DuplexChannel) {
270+
((DuplexChannel) channel).shutdownOutput();
271+
}
272+
265273
}
266274
}).start();
267275
}

0 commit comments

Comments
 (0)
X Tutup