Simon Bernier St-Pierre added the comment:
That could work. I came up with this
class MyProtocol(aio.DatagramProtocol):
def __init__(self, fut):
self._fut = fut
def datagram_received(self, data, addr):
self.fut.set_result((data, addr))
fut = aio.Future()
loop.create_datagram_endpoint(lambda: MyProtocol(fut), ...)
yield from fut
1. Is there a better way of sharing the future between the protocol and the
main function?
2. This might be inefficient because I have to create a new endpoint every time
I want to receive a packet. I might be able to implement a scheme where I give
the protocol a new future after every packet, but it's kind of cumbersome.
If I wrote the patch to make sock_recvfrom work, can it get merged or must it
go through the PEP process?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com