Don't close UDP socket on bad packet magic

This commit is contained in:
Peter Šurda 2017-10-19 09:00:02 +02:00
parent a090eea9b0
commit f785558ca5
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -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