diff options
Diffstat (limited to 'p2p/discover/udp.go')
-rw-r--r-- | p2p/discover/udp.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index 72b2a45e5..cec9046a3 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -453,8 +453,11 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, return packet, nil } -type tempError interface { - Temporary() bool +func isTemporaryError(err error) bool { + tempErr, ok := err.(interface { + Temporary() bool + }) + return ok && tempErr.Temporary() || isPacketTooBig(err) } // readLoop runs in its own goroutine. it handles incoming UDP packets. @@ -466,7 +469,7 @@ func (t *udp) readLoop() { buf := make([]byte, 1280) for { nbytes, from, err := t.conn.ReadFromUDP(buf) - if tempErr, ok := err.(tempError); ok && tempErr.Temporary() { + if isTemporaryError(err) { // Ignore temporary read errors. glog.V(logger.Debug).Infof("Temporary read error: %v", err) continue |