chisel icon indicating copy to clipboard operation
chisel copied to clipboard

Half closing of connections when CloseWrite() is available

Open liojacqs opened this issue 1 year ago • 1 comments

Fix for issue #535 Non graceful closing of remote connection

Use of CloseWrite() instead of Close() in Pipe(), only when available (typically TCP and SSH Channel). This triggers EOF on the other side instead of totally closing the TCP connection / SSH Channel, leaving the possibility to receive remaining incoming data.

Also removed sync.Once, as when io.Copy finishes we only WriteClose() or Close() the destination of the copy, which triggers io.Copy to end on the other side in cascade.

Also added dst.Close() in both pipeRemote() and handleTCP() as we still need to Close() even with CloseWrite() called in both directions.

liojacqs avatar Oct 23 '24 16:10 liojacqs

Hello, Any feedback / suggestion / remark on this ?

liojacqs avatar Dec 06 '24 08:12 liojacqs