Change error messages is backend.py to debug messages

This commit is contained in:
moyamo 2015-11-23 15:34:37 +02:00
parent a95b88e7c8
commit 03d4a98fc7

View file

@ -38,14 +38,14 @@ class SpectrumBackend:
self.send(message) self.send(message)
def handleMessageAck(self, user, legacyName, ID): def handleMessageAck(self, user, legacyName, ID):
m = protocol_pb2.ConversationMessage() m = protocol_pb2.ConversationMessage()
m.userName = user m.userName = user
m.buddyName = legacyName m.buddyName = legacyName
m.message = "" m.message = ""
m.id = ID m.id = ID
message = WRAP(m.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_CONV_MESSAGE_ACK) message = WRAP(m.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_CONV_MESSAGE_ACK)
self.send(message) self.send(message)
def handleAttention(self, user, buddyName, msg): def handleAttention(self, user, buddyName, msg):
@ -364,10 +364,10 @@ class SpectrumBackend:
if (len(self.m_data) >= 4): if (len(self.m_data) >= 4):
expected_size = struct.unpack('!I', self.m_data[0:4])[0] expected_size = struct.unpack('!I', self.m_data[0:4])[0]
if (len(self.m_data) - 4 < expected_size): if (len(self.m_data) - 4 < expected_size):
self.logger.error("Expected Data Size Error") self.logger.debug("Data packet incomplete")
return return
else: else:
self.logger.error("Data too small") self.logger.debug("Data packet incomplete")
return return
packet = self.m_data[4:4+expected_size] packet = self.m_data[4:4+expected_size]
@ -376,17 +376,15 @@ class SpectrumBackend:
parseFromString = wrapper.ParseFromString(packet) parseFromString = wrapper.ParseFromString(packet)
except: except:
self.m_data = self.m_data[expected_size+4:] self.m_data = self.m_data[expected_size+4:]
self.logger.error("Parse from String exception") self.logger.error("Parse from String exception. Skipping packet.")
return return
if parseFromString == False: if parseFromString == False:
self.m_data = self.m_data[expected_size+4:] self.m_data = self.m_data[expected_size+4:]
self.logger.error("Parse from String failed") self.logger.error("Parse from String failed. Skipping packet.")
return return
self.m_data = self.m_data[4+expected_size:] self.m_data = self.m_data[4+expected_size:]
#self.logger.error("Data Type: %s",wrapper.type)
if wrapper.type == protocol_pb2.WrapperMessage.TYPE_LOGIN: if wrapper.type == protocol_pb2.WrapperMessage.TYPE_LOGIN:
self.handleLoginPayload(wrapper.payload) self.handleLoginPayload(wrapper.payload)