Skip to content

Commit

Permalink
dispatcher: fix panic on error
Browse files Browse the repository at this point in the history
Fix nil pointer dereference panic in error case of Read from unconnected
underlay conn.
This is only a minor edge case; the problem only occured on read errors
which the dispatcher considers fatal anyway.  However, the panic did
mask the cause for the read error (in my case, too many open files) from
the logs.
Note that the router uses connected underay conns, which use a different
code path.
  • Loading branch information
matzf committed Nov 3, 2020
1 parent 20c62ae commit 8da1f1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/lib/underlay/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (c *connUDPBase) Read(b common.RawBytes) (int, *ReadMeta, error) {
}
if c.Remote != nil {
c.readMeta.Src = c.Remote
} else {
} else if src != nil {
c.readMeta.Src = &net.UDPAddr{
IP: src.IP,
Port: src.Port,
Expand Down

0 comments on commit 8da1f1a

Please sign in to comment.