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

Add connect_timeout #1

Merged
merged 1 commit into from Jun 12, 2017
Merged

Conversation

sfackler
Copy link
Member

@sfackler sfackler commented Jun 8, 2017

Unlike the rest of the API, connect_timeout does not correspond to a
single API call. However, it's a fundamental operation, and is a pain to
set up.

@sfackler
Copy link
Member Author

sfackler commented Jun 8, 2017

Untested on Windows as I don't have access to a Windows box for a couple days.

@sfackler sfackler force-pushed the connect-timeout branch 3 times, most recently from ab7443c to aa17f4b Compare June 8, 2017 21:51

let timeout = cmp::min(timeout, c_int::max_value() as u64) as c_int;

let r = unsafe { libc::poll(&mut pollfd, 1, timeout) };
Copy link
Member

Choose a reason for hiding this comment

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

I think this'll want to loop to handle EINTR, right? (or at least that'd what I'd expect a "convenient" implementation to do

Copy link
Member Author

Choose a reason for hiding this comment

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

What should we do about the timeout in that situation? Just use the original one, or try to keep it updated with a couple of Instants?

Doesn't everything use SA_RESTART, anyway?

}
}

self.set_nonblocking(false)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this could be lifted above the match r to unconditionally happen?

@sfackler
Copy link
Member Author

sfackler commented Jun 8, 2017

Updated

Unlike the rest of the API, connect_timeout does not correspond to a
single API call. However, it's a fundamental operation, and is a pain to
set up.
@alexcrichton alexcrichton merged commit f11c451 into rust-lang:master Jun 12, 2017
@alexcrichton
Copy link
Member

👍

@sfackler sfackler deleted the connect-timeout branch June 13, 2017 02:09
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.

None yet

2 participants