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