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 socket timeout when blocking on send/recv #1281

Merged
merged 1 commit into from
Oct 25, 2017
Merged

Conversation

dpkp
Copy link
Owner

@dpkp dpkp commented Oct 25, 2017

Fixes #1246

@@ -501,10 +501,10 @@ def _send_bytes_blocking(self, data):
raise ConnectionError('Buffer overrun during socket send')
return total_sent
finally:
self._sock.setblocking(False)
self._sock.settimeout(0.0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leave it as setblocking(False). It's the same as per documentation.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are the same. But I decided to use settimeout here for symmetry with the original call.

@dpkp dpkp changed the title Use socket timeout to prevent blocking forever in send Use socket timeout when blocking on send/recv Oct 25, 2017
@dpkp dpkp merged commit 34dc9dd into master Oct 25, 2017
@jeffwidman jeffwidman deleted the conn_send_timeout branch October 30, 2017 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants