mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Have SnowflakeClientConn implement io.WriterTo.
By forwarding the method to the inner smux.Stream. This is to prevent io.Copy in the top-level proxy function from allocating a buffer per client. The smux.Stream WriteTo method returns io.EOF on success, contrary to the contract of io.Copy that says it should return nil. Ignore io.EOF in the proxy loop to avoid a log message. /anti-censorship/pluggable-transports/snowflake/-/issues/40177
This commit is contained in:
parent
64491466ce
commit
77b186ae6e
2 changed files with 27 additions and 7 deletions
|
@ -57,7 +57,7 @@ func proxy(local *net.TCPConn, conn net.Conn) {
|
|||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
if _, err := io.Copy(local, conn); err != nil && !errors.Is(err, io.ErrClosedPipe) {
|
||||
if _, err := io.Copy(local, conn); err != nil && !errors.Is(err, io.EOF) && !errors.Is(err, io.ErrClosedPipe) {
|
||||
log.Printf("error copying WebSocket to ORPort %v", err)
|
||||
}
|
||||
local.CloseWrite()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue