mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Merge branch 'encapsulation-readdata-buffer'
This commit is contained in:
commit
aa06e7bef3
4 changed files with 132 additions and 60 deletions
|
@ -37,11 +37,11 @@ func newEncapsulationPacketConn(
|
|||
|
||||
// ReadFrom reads an encapsulated packet from the stream.
|
||||
func (c *encapsulationPacketConn) ReadFrom(p []byte) (int, net.Addr, error) {
|
||||
data, err := encapsulation.ReadData(c.ReadWriteCloser)
|
||||
if err != nil {
|
||||
return 0, c.remoteAddr, err
|
||||
n, err := encapsulation.ReadData(c.ReadWriteCloser, p)
|
||||
if err == io.ErrShortBuffer {
|
||||
err = nil
|
||||
}
|
||||
return copy(p, data), 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