Message260585
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? |
|
Date |
User |
Action |
Args |
2016-02-21 00:23:49 | sbstp | set | recipients:
+ sbstp, gvanrossum, vstinner, yselivanov |
2016-02-21 00:23:49 | sbstp | set | messageid: <1456014229.42.0.284680419361.issue26395@psf.upfronthosting.co.za> |
2016-02-21 00:23:49 | sbstp | link | issue26395 messages |
2016-02-21 00:23:49 | sbstp | create | |
|