Skip to content

Commit 8940958

Browse files
committed
webrtc: put buffer back to pool (#2574)
1 parent edbd0e0 commit 8940958

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

p2p/transport/webrtc/udpmux/muxed_connection.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"errors"
66
"net"
77
"time"
8+
9+
pool "github.com/libp2p/go-buffer-pool"
810
)
911

1012
var _ net.PacketConn = &muxedConnection{}
@@ -59,6 +61,7 @@ func (c *muxedConnection) ReadFrom(p []byte) (int, net.Addr, error) {
5961
if n < len(buf) {
6062
log.Debugf("short read, had %d, read %d", len(buf), n)
6163
}
64+
pool.Put(buf)
6265
return n, c.remote, nil
6366
case <-c.ctx.Done():
6467
return 0, nil, c.ctx.Err()

0 commit comments

Comments
 (0)