mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Reduce critical section when writing with TCPMux
To avoid one bad connection causing locked processes/cascading failures.
This commit is contained in:
+2
-2
@@ -149,9 +149,9 @@ func (t *tcpPacketConn) ReadFrom(b []byte) (n int, raddr net.Addr, err error) {
|
||||
// WriteTo is for active and s-o candidates.
|
||||
func (t *tcpPacketConn) WriteTo(buf []byte, raddr net.Addr) (n int, err error) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
|
||||
conn, ok := t.conns[raddr.String()]
|
||||
t.mu.Unlock()
|
||||
|
||||
if !ok {
|
||||
return 0, io.ErrClosedPipe
|
||||
// conn, err := net.DialTCP(tcp, nil, raddr.(*net.TCPAddr))
|
||||
|
||||
Reference in New Issue
Block a user