Only log detailed message type error with debug_socket argument

This commit is contained in:
shortcutme 2018-03-29 02:45:33 +02:00
parent b23a4c8288
commit 6daf583b4b
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -141,7 +141,6 @@ class Connection(object):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.connect((self.ip, int(self.port)))
# Detect protocol
self.send({"cmd": "handshake", "req_id": 0, "params": self.getHandshakeInfo()})
event_connected = self.event_connected
@ -206,10 +205,9 @@ class Connection(object):
except StopIteration:
break
if not type(message) is dict:
raise Exception(
"Invalid message type: %s, content: %r, buffer: %r" %
(type(message), message, buff[0:16])
)
if config.debug_socket:
self.log("Invalid message type: %s, content: %r, buffer: %r" % (type(message), message, buff[0:16]))
raise Exception("Invalid message type: %s" % type(message))
# Stats
self.incomplete_buff_recv = 0