From 8d05d5da6d98861345b81f61541ebe5a0b763a4b Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Wed, 14 May 2025 09:59:41 +0800 Subject: [PATCH] add max active talk requests --- p2p/discover/v5_talk.go | 2 +- p2p/discover/v5_udp.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/p2p/discover/v5_talk.go b/p2p/discover/v5_talk.go index dca09870d8..3187aafe53 100644 --- a/p2p/discover/v5_talk.go +++ b/p2p/discover/v5_talk.go @@ -28,7 +28,7 @@ import ( ) // This is a limit for the number of concurrent talk requests. -const maxActiveTalkRequests = 1024 +const maxActiveTalkRequests = 2048 // This is the timeout for acquiring a handler execution slot for a talk request. // The timeout should be short enough to fit within the request timeout. diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 223de7310a..905baae4ce 100644 --- a/p2p/discover/v5_udp.go +++ b/p2p/discover/v5_udp.go @@ -774,8 +774,8 @@ func (t *UDPv5) send(toID enode.ID, toAddr netip.AddrPort, packet v5wire.Packet, t.logcontext = append(t.logcontext, "rawpacket", hexutil.Encode(enc)) t.log.Trace(">> "+packet.Name(), t.logcontext...) - dataForSend := bufferpool.Get(len(enc)) - copy(dataForSend, enc) + dataForSend := bufferpool.Get(len(enc))[:0] + dataForSend = append(dataForSend, enc...) pw := pendingWrite{ toAddr: toAddr,