Half closing of connections when CloseWrite() is available
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.
Hello, Any feedback / suggestion / remark on this ?