continue listening after temporary errors

This commit is contained in:
Marten Seemann
2020-09-27 14:45:31 +07:00
parent a65274942c
commit b7f05b5d86
2 changed files with 14 additions and 0 deletions

View File

@@ -258,6 +258,10 @@ func (h *packetHandlerMap) listen() {
defer close(h.listening)
for {
p, err := h.conn.ReadPacket()
if nerr, ok := err.(net.Error); ok && nerr.Temporary() {
h.logger.Debugf("Temporary error reading from conn: %w", err)
continue
}
if err != nil {
h.close(err)
return