perf(netconn): адрес пайпа без аллокации на каждое чтение

This commit is contained in:
samosvalishe committed 2026-09-22 20:04:05 +03:00
1 parent f4e8e0cfe0
commit b1cbafda73
1 file changed
+4 -4
+4 -4
View File
@@ -35,15 +35,15 @@ func PacketPipe(mtu, queue int) (net.PacketConn, net.PacketConn) {
toA := make(chan *[]byte, queue) toA := make(chan *[]byte, queue)
toB := make(chan *[]byte, queue) toB := make(chan *[]byte, queue)
a := &packetPipe{local: "pipe:a", remote: "pipe:b", rx: toA, tx: toB, mtu: mtu, pool: pool, done: make(chan struct{})} a := &packetPipe{local: pipeAddr("pipe:a"), remote: pipeAddr("pipe:b"), rx: toA, tx: toB, mtu: mtu, pool: pool, done: make(chan struct{})}
b := &packetPipe{local: "pipe:b", remote: "pipe:a", rx: toB, tx: toA, mtu: mtu, pool: pool, done: make(chan struct{})} b := &packetPipe{local: pipeAddr("pipe:b"), remote: pipeAddr("pipe:a"), rx: toB, tx: toA, mtu: mtu, pool: pool, done: make(chan struct{})}
a.peer, b.peer = b, a a.peer, b.peer = b, a
return a, b return a, b
} }
type packetPipe struct { type packetPipe struct {
local pipeAddr local net.Addr
remote pipeAddr remote net.Addr
rx <-chan *[]byte rx <-chan *[]byte
tx chan<- *[]byte tx chan<- *[]byte
peer *packetPipe peer *packetPipe