Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use poll() instead of select(), unless Windows. #2865

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docker/utils/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import select
import socket as pysocket
import struct
import sys

try:
from ..transport import NpipeSocket
Expand Down Expand Up @@ -31,7 +32,13 @@ def read(socket, n=4096):
recoverable_errors = (errno.EINTR, errno.EDEADLK, errno.EWOULDBLOCK)

if not isinstance(socket, NpipeSocket):
select.select([socket], [], [])
if sys.platform == 'win32':
# Limited to 1024
select.select([socket], [], [])
else:
poll = select.poll()
poll.register(socket)
poll.poll()

try:
if hasattr(socket, 'recv'):
Expand Down