Fixed empty recv case (#4577).

This commit is contained in:
Christian P. MOMON 2020-07-10 21:26:44 +02:00 committed by root
parent 2d11e3ad35
commit 7969bf68f6

View File

@ -171,8 +171,8 @@ class Bot(object):
def msg_handler(self): # pragma: no cover (this excludes this function from testing) def msg_handler(self): # pragma: no cover (this excludes this function from testing)
new_msg = self.ircsock.recv(2048) # receive data from the server new_msg = self.ircsock.recv(2048) # receive data from the server
if not new_msg: if not new_msg:
print "Empty recv." print "Empty recv. It seems Ive lost my mind. I stop to be reborn."
new_msg='' sys.exit(7)
else: else:
new_msg = new_msg.strip('\n\r') # removing any unnecessary linebreaks new_msg = new_msg.strip('\n\r') # removing any unnecessary linebreaks
if new_msg != '' and new_msg.find("PING :") == -1: if new_msg != '' and new_msg.find("PING :") == -1: