Skip to content

Conversation

@ghostmansd
Copy link
Contributor

@ghostmansd ghostmansd commented Aug 29, 2018

This commit adds support for more knote flags (we already invoke fstat(2) upon knote creation) and makes use for one of them to fetch the pending socket error.

It is possible to determine the actual socket error via SO_ERROR socket
option. However, this system call does not work for descriptors other
than sockets, and it'd be a total waste of time to call it just to get
ENOTSOCK. In order to avoid the cost of the context switch, let's store
some additional information from the times the knote was created.
This change mostly deals with the Linux code only; likely the same
changes can be applied to Windows as well. However, this issue is to be
addressed by a separate commit.
@ghostmansd
Copy link
Contributor Author

I don't use cmake, so I had to spend some time investigating how to run the test. I invalidated some of the checks of KNFL_SOCKET_PASSIVE, and the best option seemed to make KNFL_SOCKET a bitwise OR of socket type flags. Once this change is applied, the test works as expected.

@arr2036 arr2036 merged commit f641903 into mheily:master Jan 11, 2019
@ghostmansd ghostmansd deleted the socket_errors_support branch January 12, 2019 17:13
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