1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-29 23:30:37 +08:00

optimize(p2p): tcp pdu

This commit is contained in:
源文雨
2025-02-25 22:11:30 +09:00
parent 9f36504635
commit 489537d152
2 changed files with 8 additions and 18 deletions

View File

@@ -14,7 +14,6 @@ import (
"github.com/fumiama/WireGold/config"
"github.com/fumiama/WireGold/gold/p2p"
"github.com/fumiama/orbyte/pbuf"
)
type EndPoint struct {
@@ -378,7 +377,7 @@ func (conn *Conn) ReadFromPeer(b []byte) (int, p2p.EndPoint, error) {
break
}
}
n := copy(b, p.pckt.dat.Bytes())
n := copy(b, p.pckt.dat)
return n, p.addr, nil
}
@@ -452,7 +451,7 @@ RECONNECT:
cnt, err := io.Copy(tcpconn, &packet{
typ: packetTypeNormal,
len: uint16(len(b)),
dat: pbuf.ParseBytes(b...),
dat: b,
})
if err != nil {
if subc == nil {