Rescuing a TCP socket after interface down
Rescuing a TCP socket after interface down
- Subject: Rescuing a TCP socket after interface down
- From: Sidney San MartÃn <email@hidden>
- Date: Sat, 20 Nov 2010 18:15:18 -0500
I'm poking around inside Colloquy, an IRC client which uses AsyncSocket to do its TCP dirty work.
I'm trying to improve its behavior when a network interface goes down. Currently, the instant an interface goes down, it considers itself disconnected, and tries to reconnect when the network comes back up. That's annoying behavior, and it would be nice if it waited a bit. Indeed, TN1145 says:
> There are a number of ways that an interface can temporarily go down (for example, the user strays outside of their AirPort network, or simple changes which port they're using on a hub), so it's important that you implement a time delay between when the interface disappears and when you shut down the connection.
It looks like AsyncSocket works by setting a callback on the read stream with CFReadStreamSetClient, and considers the connection closed when it gets called back with a kCFStreamEventEndEncountered event. This happens as soon as the interface goes down. Based on the docs, I think that the socket is useless after this point. I'm no CFSocket guru. How can the application be changed to deal with this condition more nicely? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden