longzhiri commented on pull request #2211:
URL: https://github.com/apache/thrift/pull/2211#issuecomment-675829636
The select() system call returns success already indicating
read()/write()/accpet() is ready, there is no need to call recv() to verify.
Non-blocking connect() is an exception, after checking for writability with
select(), you should also check for the socket errors. As man 2 connect says:
```bash
EINPROGRESS
The socket is nonblocking and the connection cannot be
completed immediately. It is possible to select(2) or poll(2) for completion
by selecting the socket for writing.
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).
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]