Fix lastSend tracking

This commit is contained in:
Josh Deprez 2024-03-30 16:48:47 +11:00
parent d24fca67b8
commit 9b3b7d2237
Signed by: josh
SSH key fingerprint: SHA256:zZji7w1Ilh2RuUpbQcqkLPrqmRwpiCSycbF2EfKm6Kw

View file

@ -77,7 +77,7 @@ func (p *peer) handle(ctx context.Context) error {
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
if rstate == receiverStateUnconnected { if sstate == senderStateUnconnected {
return ctx.Err() return ctx.Err()
} }
// Send a best-effort Router Down before returning // Send a best-effort Router Down before returning
@ -100,6 +100,7 @@ func (p *peer) handle(ctx context.Context) error {
// Send another Open-Req // Send another Open-Req
sendRetries++ sendRetries++
lastSend = time.Now()
if _, err := p.send(p.tr.NewOpenReqPacket(nil)); err != nil { if _, err := p.send(p.tr.NewOpenReqPacket(nil)); err != nil {
log.Printf("Couldn't send Open-Req packet: %v", err) log.Printf("Couldn't send Open-Req packet: %v", err)
return err return err