1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-23 20:16:27 +08:00

chore: make lint happy

This commit is contained in:
源文雨
2026-04-11 15:13:24 +08:00
parent 23d9238464
commit a85b102426

View File

@@ -38,7 +38,7 @@ func newPeerState() *peerState {
ps := &peerState{} ps := &peerState{}
ps.seqpool = &sync.Pool{ ps.seqpool = &sync.Pool{
New: func() any { New: func() any {
return int(ps.seq.Add(1)) return ps.seq.Add(1)
}, },
} }
return ps return ps
@@ -180,7 +180,7 @@ func (conn *Conn) ReadFromPeer(b []byte) (n int, ep p2p.EndPoint, err error) {
ps := conn.getOrCreatePeerState(ipaddr) ps := conn.getOrCreatePeerState(ipaddr)
ps.id = body.ID ps.id = body.ID
ps.seq.Store(uintptr(body.Seq)) ps.seq.Store(uintptr(body.Seq))
ps.seqpool.Put(body.Seq) ps.seqpool.Put(uintptr(body.Seq))
} }
n = copy(b, body.Data) n = copy(b, body.Data)
if config.ShowDebugLog { if config.ShowDebugLog {
@@ -197,7 +197,7 @@ func (conn *Conn) WriteToPeer(b []byte, ep p2p.EndPoint) (int, error) {
} }
addr := (*netip.Addr)(icmpep) addr := (*netip.Addr)(icmpep)
ps := conn.getOrCreatePeerState(*addr) ps := conn.getOrCreatePeerState(*addr)
seq := ps.seqpool.Get().(int) seq := int(ps.seqpool.Get().(uintptr))
id := ps.id id := ps.id
isrequest := id == 0 isrequest := id == 0
if isrequest { if isrequest {