rename v5respTimeout->respTimeout

Signed-off-by: Chen Kai <281165273grape@gmail.com>
This commit is contained in:
Chen Kai 2025-02-04 11:33:29 +08:00
parent 6078fe2adc
commit b1e8a7cac0

View file

@ -60,16 +60,16 @@ type codecV5 interface {
// UDPv5 is the implementation of protocol version 5. // UDPv5 is the implementation of protocol version 5.
type UDPv5 struct { type UDPv5 struct {
// static fields // static fields
conn UDPConn conn UDPConn
tab *Table tab *Table
netrestrict *netutil.Netlist netrestrict *netutil.Netlist
priv *ecdsa.PrivateKey priv *ecdsa.PrivateKey
localNode *enode.LocalNode localNode *enode.LocalNode
db *enode.DB db *enode.DB
log log.Logger log log.Logger
clock mclock.Clock clock mclock.Clock
validSchemes enr.IdentityScheme validSchemes enr.IdentityScheme
v5respTimeout time.Duration respTimeout time.Duration
// misc buffers used during message handling // misc buffers used during message handling
logcontext []interface{} logcontext []interface{}
@ -149,15 +149,15 @@ func newUDPv5(conn UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv5, error) {
cfg = cfg.withDefaults() cfg = cfg.withDefaults()
t := &UDPv5{ t := &UDPv5{
// static fields // static fields
conn: newMeteredConn(conn), conn: newMeteredConn(conn),
localNode: ln, localNode: ln,
db: ln.Database(), db: ln.Database(),
netrestrict: cfg.NetRestrict, netrestrict: cfg.NetRestrict,
priv: cfg.PrivateKey, priv: cfg.PrivateKey,
log: cfg.Log, log: cfg.Log,
validSchemes: cfg.ValidSchemes, validSchemes: cfg.ValidSchemes,
clock: cfg.Clock, clock: cfg.Clock,
v5respTimeout: cfg.V5RespTimeout, respTimeout: cfg.V5RespTimeout,
// channels into dispatch // channels into dispatch
packetInCh: make(chan ReadPacket, 1), packetInCh: make(chan ReadPacket, 1),
readNextCh: make(chan struct{}, 1), readNextCh: make(chan struct{}, 1),
@ -576,7 +576,7 @@ func (t *UDPv5) startResponseTimeout(c *callV5) {
timer mclock.Timer timer mclock.Timer
done = make(chan struct{}) done = make(chan struct{})
) )
timer = t.clock.AfterFunc(t.v5respTimeout, func() { timer = t.clock.AfterFunc(t.respTimeout, func() {
<-done <-done
select { select {
case t.respTimeoutCh <- &callTimeout{c, timer}: case t.respTimeoutCh <- &callTimeout{c, timer}: