在connect接口的使用说明里,有这个错误: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).
如果socket的设置是non-blocking,而且不能立即完成connection,就会返回这个错误。如果返回这个错误,后续需要上层应用使用select/poll等这个socket的connection完成。
所以,这个错误不代表有问题,只是说明,当前的connection还在进行中。
在tcp_connection函数,没有等syn-ack的逻辑,只是会起一个timer来等是否要重新发送syn消息,也就是等syn-ack超时。所以。
tcp_connect
inet_csk_reset_xmit_timer