From e9edc1634947519df3589f62a7baecd2c2b6f593 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 21 Sep 2020 15:17:16 -0700 Subject: device: fix error shadowing before log print Signed-off-by: Brad Fitzpatrick --- device/receive.go | 8 ++++---- 1 file 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) - } } } -- cgit v1.2.3