UDP socket closing fix

- invalid data or an incomplete read on UDP socket caused
it to close
This commit is contained in:
Peter Šurda 2017-10-19 01:46:32 +02:00
parent 9cffd50de8
commit 7e0932815d
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -114,6 +114,9 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
logger.debug("%s:%i already got object, skipping", self.destination.host, self.destination.port) logger.debug("%s:%i already got object, skipping", self.destination.host, self.destination.port)
except struct.error: except struct.error:
logger.debug("decoding error, skipping") logger.debug("decoding error, skipping")
elif self.socket.type == socket.SOCK_DGRAM:
# broken read, ignore
pass
else: else:
#print "Skipping command %s due to invalid data" % (self.command) #print "Skipping command %s due to invalid data" % (self.command)
logger.debug("Closing due to invalid command %s", self.command) logger.debug("Closing due to invalid command %s", self.command)