This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbstp
Recipients gvanrossum, sbstp, vstinner, yselivanov
Date 2016-02-21.00:23:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456014229.42.0.284680419361.issue26395@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-02-21 00:23:49sbstpsetrecipients: + sbstp, gvanrossum, vstinner, yselivanov
2016-02-21 00:23:49sbstpsetmessageid: <1456014229.42.0.284680419361.issue26395@psf.upfronthosting.co.za>
2016-02-21 00:23:49sbstplinkissue26395 messages
2016-02-21 00:23:49sbstpcreate