Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 079110a

Browse files
committed
Correctly handle non-address-related errors like I/O timeouts.
1 parent 010be81 commit 079110a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

connection.go

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ func newConn(sock *net.UDPConn, local, remote net.Addr) *Conn {
1818
func (c *Conn) Read(b []byte) (int, error) {
1919
for {
2020
n, addr, err := c.conn.ReadFrom(b)
21+
// Generic non-address related errors.
22+
if addr == nil && err != nil {
23+
return n, err
24+
}
25+
// Filter out anything not related to the address we care
26+
// about.
2127
if addr.Network() != c.remote.Network() || addr.String() != c.remote.String() {
2228
continue
2329
}

0 commit comments

Comments
 (0)