small fix to coresendmsg and client disconnects no longer log as an exception

This commit is contained in:
Blake J. Harnden 2018-03-16 13:10:34 -07:00
parent d46aaa1005
commit bc1ef88f82
2 changed files with 8 additions and 5 deletions

View file

@ -506,7 +506,10 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
while True:
try:
message = self.receive_message()
except (IOError, EOFError):
except EOFError:
logger.info("client disconnected")
break
except IOError:
logger.exception("error receiving message")
break

View file

@ -98,7 +98,7 @@ def connect_to_session(sock, requested):
connect to the first one.
"""
# request the session list
tlvdata = coreapi.CoreSessionTlv.pack(SessionTlvs.NUMBER.value, "0")
tlvdata = coreapi.CoreSessionTlv.pack(SessionTlvs.NUMBER.value, "")
flags = MessageFlags.STRING.value
smsg = coreapi.CoreSessionMessage.pack(flags, tlvdata)
sock.sendall(smsg)
@ -130,9 +130,9 @@ def connect_to_session(sock, requested):
print "requested session not found!"
return False
print "joining session %s..." % session
tlvdata = coreapi.CoreSessionTlv.pack(SessionTlvs.NUMBER, session)
flags = MessageFlags.ADD
print "joining session: %s" % session
tlvdata = coreapi.CoreSessionTlv.pack(SessionTlvs.NUMBER.value, session)
flags = MessageFlags.ADD.value
smsg = coreapi.CoreSessionMessage.pack(flags, tlvdata)
sock.sendall(smsg)
return True