Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement wait_for_[read,write} directly on top of 'select' module Our vendored backport of the 'selectors' module is huge, its tests are flaky, and the only we thing we use it for is to... turn around and implement some trivial select() operations. It lets urllib3 use epoll or kqueue... but the way urllib3 uses them, they're actually *less* efficient than just using poll or select. This commit removes the dependency on 'selectors', by implementing urllib3's wait_for_{read,write} helpers directly on top of poll/select. Because I'm sneaky, it does this in terms of a more generic wait_for_socket(...) operation, which is exactly the primitive that we need for the bleach-spike branch (see gh-1323), so this should also help keep the diff down. * Delete selectors backport Now that we're not using it anymore (see previous commit), it can be deleted. * Address comments from review - Check that poll works before using it - Add a test for detecting readability after the peer closes the socket - Remove an unnecessary coverage-control comment * Delay choice of wait_for_socket backend until first call To work around things like: import urllib3 from gevent import monkey monkey.patch_all() Since this means we no longer make an import-time decision about wait_for_socket support, I also got rid of the constant HAS_WAIT_FOR_SOCKET. * Add test for calling wait_for_socket on a closed socket * Fix lint errors
- Loading branch information