def doJob(self, job): sock = job['sock'] addr = job['addr'] cmds = job['commands'] socket_ok = True for c in cmds: c = c.strip() try: res = Command.processCmd(re.compile("\s").split(c)) + "\r\n" except: Logger.exception() continue try: if socket_ok: if sock.fileno() in self.manager.server.connections: # send the response only if we still have # someone to talk to sock.send(res) else: socket_ok = False Logger.info("client " + addr[0] + ":" + str(addr[1]) + " left while trying to send response for command `" + c + "`") except: socket_ok = False Logger.warn("client " + addr[0] + ":" + str(addr[1]) + " left while trying to send response for command `" + c + "`")