Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def wait(self):
while True:
read_fds, write_fds = self.channel.getsock()
if not read_fds and not write_fds:
break
timeout = self.channel.timeout()
if timeout == 0.0:
self.channel.process_fd(pycares.ARES_SOCKET_BAD, pycares.ARES_SOCKET_BAD)
continue
rlist, wlist, xlist = select.select(read_fds, write_fds, [], timeout)
for fd in rlist:
self.channel.process_fd(fd, pycares.ARES_SOCKET_BAD)
for fd in wlist:
self.channel.process_fd(pycares.ARES_SOCKET_BAD, fd)
def wait(self):
while True:
read_fds, write_fds = self.channel.getsock()
if not read_fds and not write_fds:
break
timeout = self.channel.timeout()
if timeout == 0.0:
self.channel.process_fd(pycares.ARES_SOCKET_BAD, pycares.ARES_SOCKET_BAD)
continue
rlist, wlist, xlist = select.select(read_fds, write_fds, [], timeout)
for fd in rlist:
self.channel.process_fd(fd, pycares.ARES_SOCKET_BAD)
for fd in wlist:
self.channel.process_fd(pycares.ARES_SOCKET_BAD, fd)
def _wait_channel(cls):
try:
while True:
read_fds, write_fds = cls._channel.getsock()
if not read_fds and not write_fds:
break
timeout = cls._channel.timeout()
if not timeout:
cls._channel.process_fd(pycares.ARES_SOCKET_BAD,
pycares.ARES_SOCKET_BAD)
continue
rlist, wlist, xlist = select.select(
read_fds, write_fds, [], timeout)
for fd in rlist:
cls._channel.process_fd(fd, pycares.ARES_SOCKET_BAD)
for fd in wlist:
cls._channel.process_fd(pycares.ARES_SOCKET_BAD, fd)
except Exception:
logging.log_exception(__name__)
cls._channel.cancel()
cls._channel = None
raise
finally:
cls._thread = None
def _poll_cb(self, handle, events, error):
read_fd = handle.fd
write_fd = handle.fd
if error is not None:
# There was an error, pretend the socket is ready
self._channel.process_fd(read_fd, write_fd)
return
if not events & pyuv.UV_READABLE:
read_fd = pycares.ARES_SOCKET_BAD
if not events & pyuv.UV_WRITABLE:
write_fd = pycares.ARES_SOCKET_BAD
self._channel.process_fd(read_fd, write_fd)
def wait_channel(channel):
while True:
read_fds, write_fds = channel.getsock()
if not read_fds and not write_fds:
break
timeout = channel.timeout()
if not timeout:
channel.process_fd(pycares.ARES_SOCKET_BAD, pycares.ARES_SOCKET_BAD)
continue
rlist, wlist, xlist = select.select(read_fds, write_fds, [], timeout)
for fd in rlist:
channel.process_fd(fd, pycares.ARES_SOCKET_BAD)
for fd in wlist:
channel.process_fd(pycares.ARES_SOCKET_BAD, fd)
def wait_channel(channel):
while True:
read_fds, write_fds = channel.getsock()
if not read_fds and not write_fds:
break
timeout = channel.timeout()
if not timeout:
channel.process_fd(pycares.ARES_SOCKET_BAD, pycares.ARES_SOCKET_BAD)
continue
rlist, wlist, xlist = select.select(read_fds, write_fds, [], timeout)
for fd in rlist:
channel.process_fd(fd, pycares.ARES_SOCKET_BAD)
for fd in wlist:
channel.process_fd(pycares.ARES_SOCKET_BAD, fd)
def wait_channel(self):
while True:
if not self._fd_map:
break
timeout = self._channel.timeout(1.0)
if not timeout:
self._channel.process_fd(pycares.ARES_SOCKET_BAD, pycares.ARES_SOCKET_BAD)
continue
for key, event in self.poll.select(timeout):
read_fd = key.fd if event & selectors.EVENT_READ else pycares.ARES_SOCKET_BAD
write_fd = key.fd if event & selectors.EVENT_WRITE else pycares.ARES_SOCKET_BAD
self._channel.process_fd(read_fd, write_fd)
def wait_channel(self):
while True:
if not self._fd_map:
break
timeout = self._channel.timeout(1.0)
if not timeout:
self._channel.process_fd(pycares.ARES_SOCKET_BAD, pycares.ARES_SOCKET_BAD)
continue
for key, event in self.poll.select(timeout):
read_fd = key.fd if event & selectors.EVENT_READ else pycares.ARES_SOCKET_BAD
write_fd = key.fd if event & selectors.EVENT_WRITE else pycares.ARES_SOCKET_BAD
self._channel.process_fd(read_fd, write_fd)
def _handle_events(self, fd, events):
read_fd = pycares.ARES_SOCKET_BAD
write_fd = pycares.ARES_SOCKET_BAD
if events & IOLoop.READ:
read_fd = fd
if events & IOLoop.WRITE:
write_fd = fd
self.channel.process_fd(read_fd, write_fd)
def _handle_events(self, fd, events):
read_fd = pycares.ARES_SOCKET_BAD
write_fd = pycares.ARES_SOCKET_BAD
if events & IOLoop.READ:
read_fd = fd
if events & IOLoop.WRITE:
write_fd = fd
self.channel.process_fd(read_fd, write_fd)