def shutdown(sock, timeout=None): """Shut down SSL. Calls the SSL shutdown method until it completes. The calling task will be suspended until this completes. """ if timeout is not None: end = time.time() + timeout h = greennet.get_hub() while not sock.shutdown(): h.poll(sock, read=sock.want_read(), write=sock.want_write(), timeout=timeout) if timeout is not None: timeout = end - time.time()
def __init__(self, maxlen=None, hub=None): self.queue = deque() self.maxlen = maxlen self.hub = get_hub() if hub is None else hub self._append_waits = deque() self._pop_waits = deque()
def __init__(self, hub=None): self.hub = get_hub() if hub is None else hub self._gun, self._trigger = os.pipe() self._closed = False