conn: make binds replacable

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld committed 2021-02-23 20:00:57 +01:00
1 parent c69481f1b3
commit a4f8e83d5d
16 files changed
+160 -149

No files matched your search

+2 -7
View File
@@ -126,13 +126,8 @@ func (peer *Peer) SendBuffer(buffer []byte) error {
peer.device.net.RLock()
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() {
return nil
}
return errors.New("no bind")
if peer.device.isClosed() {
return nil
}
peer.RLock()