1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00

device: fix error shadowing before log print

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2020-09-21 15:17:16 -07:00 committed by Jason A. Donenfeld
parent f7bbdc31a0
commit e9edc16349

View File

@ -633,14 +633,14 @@ func (peer *Peer) RoutineSequentialReceiver() {
offset := MessageTransportOffsetContent offset := MessageTransportOffsetContent
_, err := device.tun.device.Write(elem.buffer[:offset+len(elem.packet)], offset) _, 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 { if len(peer.queue.inbound) == 0 {
err = device.tun.device.Flush() err := device.tun.device.Flush()
if err != nil { if err != nil {
peer.device.log.Error.Printf("Unable to flush packets: %v", err) 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)
}
} }
} }