def send_to_worker(chunk_index, chunk1, chunk2=None): worker_index = queue.get() connection = connections[worker_index] connection.send(chunk_index) connection.send_bytes(chunk1) if chunk2 is not None: connection.send_bytes(chunk2)
def send_bytes(self, obj, **kwargs): for connection in self.send_connections.values(): connection.send_bytes(obj, **kwargs)