diff --git a/device/peer.go b/device/peer.go index 02e145c..c2397cc 100644 --- a/device/peer.go +++ b/device/peer.go @@ -140,6 +140,11 @@ func (peer *Peer) SendBuffer(buffer []byte) error { defer peer.device.net.RUnlock() if peer.device.net.bind == nil { + // Packets can leak through to SendBuffer while the device is closing. + // When that happens, drop them silently to avoid spurious errors. + if peer.device.isClosed.Get() { + return nil + } return errors.New("no bind") }