From f785558ca556d7b3b3968c326db31d0ee6c06181 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 19 Oct 2017 09:00:02 +0200 Subject: [PATCH] Don't close UDP socket on bad packet magic --- src/network/bmproto.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/network/bmproto.py b/src/network/bmproto.py index c245a675..3ae7b635 100644 --- a/src/network/bmproto.py +++ b/src/network/bmproto.py @@ -74,7 +74,9 @@ class BMProto(AdvancedDispatcher, ObjectTracker): self.set_state("bm_header", length=1) self.bm_proto_reset() logger.debug("Bad magic") - self.handle_close("Bad magic") + if self.socket.type == socket.SOCK_STREAM: + self.close_reason = "Bad magic" + self.set_state("close") return False if self.payloadLength > BMProto.maxMessageSize: self.invalid = True