diff options
author | David Fifield <david@bamsoftware.com> | 2023-06-26 02:12:46 +0000 |
---|---|---|
committer | David Fifield <david@bamsoftware.com> | 2023-11-07 05:51:35 +0000 |
commit | 001f691b475a2d7e02c9fe9800bb6dac8a076bb5 (patch) | |
tree | bc66a02ffaa06fd248e1b063b067d95908515fa7 /client | |
parent | 648609dbea31d5ba604d00a7f765a1a47d673896 (diff) | |
download | snowflake-001f691b475a2d7e02c9fe9800bb6dac8a076bb5.tar.gz snowflake-001f691b475a2d7e02c9fe9800bb6dac8a076bb5.zip |
Have encapsulation.ReadData read into a provided buffer.
Instead of unconditionally allocating its own.
Diffstat (limited to 'client')
-rw-r--r-- | client/lib/turbotunnel.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/client/lib/turbotunnel.go b/client/lib/turbotunnel.go index f2141e9..d36eadd 100644 --- a/client/lib/turbotunnel.go +++ b/client/lib/turbotunnel.go @@ -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) + n, err := encapsulation.ReadData(c.ReadWriteCloser, p) if err != nil { - return 0, c.remoteAddr, err + return n, c.remoteAddr, err } - return copy(p, data), c.remoteAddr, nil + return n, c.remoteAddr, nil } // WriteTo writes an encapsulated packet to the stream. |