diff --git a/common/buf/io.go b/common/buf/io.go index 0b801449..71794b69 100644 --- a/common/buf/io.go +++ b/common/buf/io.go @@ -79,6 +79,13 @@ func NewWriter(writer io.Writer) Writer { return mw } + if _, ok := writer.(syscall.Conn); !ok { + // If the writer doesn't implement syscall.Conn, it is probably not a TCP connection. + return &SequentialWriter{ + Writer: writer, + } + } + return &BufferToBytesWriter{ Writer: writer, }