diff options
author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2020-09-21 15:17:16 -0700 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-17 12:15:14 +0100 |
commit | 9c4bcedf80ee12e737fb482e7972beb0b84c3361 (patch) | |
tree | 00c4af440fc2d760dd3b8c6676bf9d91be025401 | |
parent | 26b0dca4f569ccd1fb02fe3742cbed8595b24728 (diff) | |
download | wireguard-go-9c4bcedf80ee12e737fb482e7972beb0b84c3361.tar.gz wireguard-go-9c4bcedf80ee12e737fb482e7972beb0b84c3361.zip |
device: fix error shadowing before log print
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rw-r--r-- | device/receive.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/device/receive.go b/device/receive.go index aeaae51..e9cf2bc 100644 --- a/device/receive.go +++ b/device/receive.go @@ -633,14 +633,14 @@ func (peer *Peer) RoutineSequentialReceiver() { offset := MessageTransportOffsetContent _, err := device.tun.device.Write(elem.buffer[:offset+len(elem.packet)], offset) + if err != nil && !device.isClosed.Get() { + logError.Println("Failed to write packet to TUN device:", err) + } if len(peer.queue.inbound) == 0 { - err = device.tun.device.Flush() + err := device.tun.device.Flush() if err != nil { peer.device.log.Error.Printf("Unable to flush packets: %v", err) } } - if err != nil && !device.isClosed.Get() { - logError.Println("Failed to write packet to TUN device:", err) - } } } |