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

Fix: Socket#accept obeys read_timeout #9538

Merged
merged 1 commit into from
Jul 3, 2020

Conversation

waj
Copy link
Member

@waj waj commented Jun 23, 2020

Currently if a read_timeout is used on a Socket, accept_impl will just keep looping until a connection is received. This was already noticed by @grioja on this comment. I refactored the internal implementation so it doesn't rely on exception handling.

I was hesitant about making accept? to return nil in case of timeout. But there are currently parts of the code that assumes that if a nil is returned it's because the socket was closed. On the other hand this was the behaviour until #8707 was merged so that would be a breaking change to do in a separate PR if that's desired.

@waj waj added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking labels Jun 23, 2020
@waj waj added this to the 1.0.0 milestone Jun 30, 2020
@waj waj merged commit 3857fbb into crystal-lang:master Jul 3, 2020
@waj waj deleted the fix/socket-accept-timeout branch July 3, 2020 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants