def _async_recvfrom(self, *args):
"""Internal use only; use 'recvfrom' with 'yield' instead.
Asynchronous version of socket recvfrom method.
"""
def _recvfrom():
try:
buf = self._rsock.recvfrom(*args)
except:
self._read_fn = None
self._notifier.clear(self, _AsyncPoller._Read)
self._read_task.throw(*sys.exc_info())
else:
self._read_fn = None
self._notifier.clear(self, _AsyncPoller._Read)
self._read_task._proceed_(buf)
if not self._scheduler:
self._scheduler = Pycos.scheduler()
self._notifier = self._scheduler._notifier
self._register()
self._read_task = Pycos.cur_task(self._scheduler)
self._read_task._await_()
self._read_fn = _recvfrom
self._notifier.add(self, _AsyncPoller._Read)
评论列表
文章目录