mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Don't do a separate check for a short write.
A short write will result in a non-nil error. It's an io.PipeWriter anyway, which blocks until all the data has been read or the read end is closed, in which case it returns io.ErrClosedPipe if not some other error.
This commit is contained in:
parent
51bb49fa6f
commit
d9b076c32e
1 changed files with 1 additions and 5 deletions
|
@ -239,8 +239,8 @@ func (c *WebRTCPeer) establishDataChannel() error {
|
||||||
if len(msg.Data) <= 0 {
|
if len(msg.Data) <= 0 {
|
||||||
log.Println("0 length message---")
|
log.Println("0 length message---")
|
||||||
}
|
}
|
||||||
c.BytesLogger.AddInbound(len(msg.Data))
|
|
||||||
n, err := c.writePipe.Write(msg.Data)
|
n, err := c.writePipe.Write(msg.Data)
|
||||||
|
c.BytesLogger.AddInbound(n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: Maybe shouldn't actually close.
|
// TODO: Maybe shouldn't actually close.
|
||||||
log.Println("Error writing to SOCKS pipe")
|
log.Println("Error writing to SOCKS pipe")
|
||||||
|
@ -248,10 +248,6 @@ func (c *WebRTCPeer) establishDataChannel() error {
|
||||||
log.Printf("c.writePipe.CloseWithError returned error: %v", inerr)
|
log.Printf("c.writePipe.CloseWithError returned error: %v", inerr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if n != len(msg.Data) {
|
|
||||||
log.Println("Error: short write")
|
|
||||||
panic("short write")
|
|
||||||
}
|
|
||||||
c.lastReceive = time.Now()
|
c.lastReceive = time.Now()
|
||||||
})
|
})
|
||||||
log.Println("WebRTC: DataChannel created.")
|
log.Println("WebRTC: DataChannel created.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue