在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