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

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