def init_file_dispatcher(self, fd):
"""
Kludge to plug asyncore.file_dispatcher into asynchat. Call from
subclass's __init__() method, after calling
PDUChannel.__init__(), and don't read this on a full stomach.
"""
self.connected = True
self._fileno = fd
self.socket = asyncore.file_wrapper(fd)
self.add_channel()
flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0)
flags = flags | os.O_NONBLOCK
fcntl.fcntl(fd, fcntl.F_SETFL, flags)
评论列表
文章目录