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>
This commit is contained in:
parent
a544776d70
commit
60a26371f4
@ -94,6 +94,7 @@ func (device *Device) RoutineReceiveIncoming(recv conn.ReceiveFunc) {
|
|||||||
size, endpoint, err = recv(buffer[:])
|
size, endpoint, err = recv(buffer[:])
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
device.log.Verbosef("Routine: receive incoming %s - failed to receive packet: %v", recvName, err)
|
||||||
device.PutMessageBuffer(buffer)
|
device.PutMessageBuffer(buffer)
|
||||||
if errors.Is(err, net.ErrClosed) {
|
if errors.Is(err, net.ErrClosed) {
|
||||||
return
|
return
|
||||||
@ -101,7 +102,6 @@ func (device *Device) RoutineReceiveIncoming(recv conn.ReceiveFunc) {
|
|||||||
if neterr, ok := err.(net.Error); ok && !neterr.Temporary() {
|
if neterr, ok := err.(net.Error); ok && !neterr.Temporary() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
device.log.Errorf("Failed to receive packet: %v", err)
|
|
||||||
if deathSpiral < 10 {
|
if deathSpiral < 10 {
|
||||||
deathSpiral++
|
deathSpiral++
|
||||||
time.Sleep(time.Second / 3)
|
time.Sleep(time.Second / 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user