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 read into a provided buffer.
Instead of unconditionally allocating its own.
This commit is contained in:
parent
648609dbea
commit
001f691b47
4 changed files with 122 additions and 58 deletions
|
@ -173,12 +173,13 @@ func (handler *httpHandler) turbotunnelMode(conn net.Conn, addr net.Addr) error
|
|||
go func() {
|
||||
defer wg.Done()
|
||||
defer close(done) // Signal the write loop to finish
|
||||
var p [2048]byte
|
||||
for {
|
||||
p, err := encapsulation.ReadData(conn)
|
||||
n, err := encapsulation.ReadData(conn, p[:])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
pconn.QueueIncoming(p, clientID)
|
||||
pconn.QueueIncoming(p[:n], clientID)
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue