From 061aff8ddc9def370bdec3a2f3aebd97e5fcfc7b Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Sun, 19 May 2019 17:23:55 +0100 Subject: [PATCH] [magneticod] detect UDP socket closure reliably --- cmd/magneticod/dht/mainline/transport.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/magneticod/dht/mainline/transport.go b/cmd/magneticod/dht/mainline/transport.go index 0554237..3f993ed 100644 --- a/cmd/magneticod/dht/mainline/transport.go +++ b/cmd/magneticod/dht/mainline/transport.go @@ -94,7 +94,8 @@ func (t *Transport) readMessages() { zap.L().Warn("READ CONGESTION!", zap.Error(err)) t.onCongestion() } else if err != nil { - zap.L().Warn("Could NOT read an UDP packet!", zap.Error(err)) + // Socket is probably closed + break } if n == 0 {