Skip to content

Commit f673e08

Browse files
committed
Remove bad connections to avoid spamming errors
1 parent f4d7f8e commit f673e08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/sslnet/udp_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ func (c *UdpClient) Stop() {
6565
func (c *UdpClient) Send(data []byte) {
6666
c.mutex.Lock()
6767
defer c.mutex.Unlock()
68-
for _, conn := range c.conns {
68+
for i, conn := range c.conns {
6969
if _, err := conn.Write(data); err != nil {
7070
log.Printf("%v - Could not write to %s at %s: %s", c.Name, conn.RemoteAddr(), conn.LocalAddr(), err)
71+
// Remove this connection
72+
c.conns = append(c.conns[:i], c.conns[i+1:]...)
7173
}
7274
}
7375
}

0 commit comments

Comments
 (0)