def receive_twisted(self, channels):
"""Twisted-native implementation of receive."""
deferred = defer.Deferred()
def resolve_deferred(future):
reactor.callFromThread(deferred.callback, future.result())
future = self.thread.twisted_schedule(RECEIVE_TWISTED, channels)
future.add_done_callback(resolve_deferred)
defer.returnValue((yield deferred))
# TODO: Is it optimal to read bytes from content frame, call python
# decode method to convert it to string and than parse it with
# msgpack? We should minimize useless work on message receive.
评论列表
文章目录