mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Have encapsulation.ReadData return an error when the buffer is short.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/154#note_2919109 Still ignoring the io.ErrShortBuffer at the callers, which retains current behavior.
This commit is contained in:
parent
001f691b47
commit
d99f31d881
4 changed files with 24 additions and 16 deletions
|
@ -38,10 +38,10 @@ func newEncapsulationPacketConn(
|
|||
// ReadFrom reads an encapsulated packet from the stream.
|
||||
func (c *encapsulationPacketConn) ReadFrom(p []byte) (int, net.Addr, error) {
|
||||
n, err := encapsulation.ReadData(c.ReadWriteCloser, p)
|
||||
if err != nil {
|
||||
return n, c.remoteAddr, err
|
||||
if err == io.ErrShortBuffer {
|
||||
err = nil
|
||||
}
|
||||
return n, c.remoteAddr, nil
|
||||
return n, c.remoteAddr, err
|
||||
}
|
||||
|
||||
// WriteTo writes an encapsulated packet to the stream.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue