def write_data(self, msg_producer): if self.transport.is_closing(): return if self.transport is None: self._buffered_data.append( protocols.create_msgpack_message(msg_producer.msg2str())) else: self.transport.write( protocols.create_msgpack_message(msg_producer.msg2str()))
def process(self): conn_id = self.data[b'conn_id'] if conn_id in TASKS: protocol = TASKS[conn_id] msg = protocols.CloseConnProducer(conn_id=conn_id) if protocol.transport and not protocol.transport.is_closing(): protocol.transport.write( protocols.create_msgpack_message(msg.msg2str())) protocol.transport.close() del TASKS[conn_id]
def write_data(self, msg_producer): self.transport.write(protocols.create_msgpack_message(msg_producer.msg2str()))