[maemo-developers] Delaying actions on network availability

From: koos vriezen koos.vriezen at gmail.com
Date: Sun Feb 21 12:27:24 EET 2010
2010/2/21 olle <olle at nxs.se>:
> On Sat, Feb 20, 2010 at 09:49:48PM +0100, koos vriezen wrote:
>>
>> > I've set up OpenVPN to tunnel all traffic on my N900 and it works beautifully with /etc/network/if-up / down scripts.
>> >
>> > Problem is, while OpenVPN is connecting, the IM clients all connect and then when the tunnel is up and default route is re-set it takes ages for them to time-out and reconnect.
>> >
>> > Is there any way to delay actions that happen on network availability (IM connect, mail sync, etc.)?
>>
>> Interesting, I have a similar problem with kmplayer's download page
>> detecting the network connection has gone.
>> Looking a bit inside /proc/sys/net/ipv4/ I see that tcp_keepalive_*
>> might be useful in this respect. According to
>> http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html the
>> connection is terminated 9*75+7200 secs, i.e. about 2:11:15.
>> No idea if lowering these values will help though.
>
> I'd rather not tweak the actual timeouts but delay the connections til after the VPN is up.
> Another possible solution I thought about is faking a network disconnect/connect over dbus after th VPN is up to make all apps reconnect. Thoughts?

Yeah and whether SO_KEEPALIVE is at all.

A wifi disconnect doesn't close sockets, so the app has to response to
the CON_IC_STATUS_DISCONNECTED signal to close its sockets. I always
assumed that sockets can survive a fast reconnection (NAT connection
tables might be flushed in case the hotspot is the NAT router, dunno).
I guess you can simulate this by disconnecting/connecting your wifi/3g
connection?

Koos
More information about the maemo-developers mailing list