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

Ensure that errno is set correctly after hdhomerun_sock_connect #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tmm1
Copy link

@tmm1 tmm1 commented Sep 28, 2018

Makes sure that errno is set correctly after hdhomerun_sock_connect returns, which makes it possible for the caller to notify the user about the exact error condition.

@tmm1
Copy link
Author

tmm1 commented Sep 28, 2018

I've seen and used the "call connect() again after poll/select" pattern before, which is why I implemented it here.

But according to the linux connect(2) man page, another alternative is to use getsockopt to get the connection status:

After select(2) indicates writability, use getsockopt(2) to read the
SO_ERROR option at level SOL_SOCKET to determine whether
connect() completed successfully (SO_ERROR is zero) or
unsuccessfully (SO_ERROR is one of the usual error codes
listed here, explaining the reason for the failure).

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

1 participant