def queue_operation(self, op): if not self.running: op.network_error() return for o in self.ops: assert op.opaque != o.opaque self.ops.append(op) self.socket.send(op.bytes())
def _connection_lost(self): self.running = False for op in self.ops: op.network_error() self.ops.remove(op) logging.warning("Socket closed unexpectedly")