diff options
author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2020-09-21 15:17:16 -0700 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-07 14:49:44 +0100 |
commit | e9edc1634947519df3589f62a7baecd2c2b6f593 (patch) | |
tree | 00c4af440fc2d760dd3b8c6676bf9d91be025401 | |
parent | f7bbdc31a0065e3d5a68a3e6c7a7449954fdd339 (diff) |
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) - } } } |