diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2021-04-27 10:15:15 -0700 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-05-06 11:22:13 +0200 |
commit | 60a26371f42f5c0a9ce1ffb2b85b739d80085f2a (patch) | |
tree | 1f9dd19ce7c2e83d1692b64836e0992306c1ccc1 | |
parent | a544776d703df47974fe83e6a63e91c3ffc62500 (diff) |
device: log all errors received by RoutineReceiveIncoming
When debugging, it's useful to know why a receive func exited.
We were already logging that, but only in the "death spiral" case.
Move the logging up, to capture it always.
Reduce the verbosity, since it is not an error case any more.
Put the receive func name in the log line.
Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
-rw-r--r-- | device/receive.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/device/receive.go b/device/receive.go index 9af0e18..13f62eb 100644 --- a/device/receive.go +++ b/device/receive.go @@ -94,6 +94,7 @@ func (device *Device) RoutineReceiveIncoming(recv conn.ReceiveFunc) { size, endpoint, err = recv(buffer[:]) if err != nil { + device.log.Verbosef("Routine: receive incoming %s - failed to receive packet: %v", recvName, err) device.PutMessageBuffer(buffer) if errors.Is(err, net.ErrClosed) { return @@ -101,7 +102,6 @@ func (device *Device) RoutineReceiveIncoming(recv conn.ReceiveFunc) { if neterr, ok := err.(net.Error); ok && !neterr.Temporary() { return } - device.log.Errorf("Failed to receive packet: %v", err) if deathSpiral < 10 { deathSpiral++ time.Sleep(time.Second / 3) |