Why unplugging network cable not cause TCP state change?
Why unplugging network cable not cause TCP state change?
- Subject: Why unplugging network cable not cause TCP state change?
- From: 周章林 <email@hidden>
- Date: Tue, 26 Apr 2016 15:36:40 +0800
Hi, all,
I use libcurl to connect a HTTPS server in my project, and libcurl maintains a connection(socket) pool for the connection to same host, this is useful because ssl handshake is expensive. My project works well in most time. The problem is when the network cable is shutdown for a moment(usually the network cable is unplugged), sometimes the connections(socket) in connection pool keep "ESTABLISHED" state( I use "netstat" to get this information), so when the network is recovered, the next connection to previous HTTPS server will cost long time, because libcur will try connections(socket) in connection pool one by one, in fact, these connections(socket) have been invalid, but there is not a way to verify it(the tcp state is still "ESTABLISHED"), libcurl tries to send a message and wait timeout, so each connection in the connections pool will cost almost 2 minutes to get timeout. When all connections are timeout, finally a new connection is created and I can connect to the HTTPS server successfully.
The problem here is: why unplugging network cable not change the socket's TCP state sometimes? Please note, sometimes, when the network cable is unplugged, the socket's tcp state is changed from "ESTABLISHED" to "CLOSE_WAIT" soon, sometimes not.
My OS version is 10.10.5 (14F1713), Kernel Version is Darwin 14.5.0.
--zhanglin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden