]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: log all errors received by RoutineReceiveIncoming
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 27 Apr 2021 17:15:15 +0000 (10:15 -0700)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 6 May 2021 09:22:13 +0000 (11:22 +0200)
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>
device/receive.go

index 9af0e1898599c37fb7c553ad680bea0d9bb921bf..13f62eb758aaa169af76da70c3ad4aae7d5c8a03 100644 (file)
@@ -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)