Bug 56589

Summary: Make Idle disconnect if it doesn't get a reply to its pings.
Product: Telepathy Reporter: Will Thompson <will>
Component: idleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: git master   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/wjt/telepathy-idle/log/?h=ping
Whiteboard: r+
i915 platform: i915 features:

Description Will Thompson 2012-10-30 17:03:19 UTC
Right now, Idle sends out PINGs every 30 seconds, but doesn't do anything if the server doesn't answer them.

This is … not great. If the connection has died for some reason—maybe you had both wired and wireless, Idle connected over the wire, and then you unplugged the cable? This happens to me every single day—Idle really ought to notice and disconnect. So here's a branch which does that. It also fixes the force-disconnect path if you try to explicitly Disconnect() on such a connection to not wait forever for the TCP connection to close cleanly.
Comment 1 Jonny Lamb 2012-10-31 19:59:17 UTC
+ if (seconds_since_ping > priv->keepalive_interval * MISSED_KEEPALIVES_BEFORE_DISCONNECTING) {

I personally love as many brackets as possible to make everything clear.

Otherwise looks great! What a nice easy branch to review, thanks!
Comment 2 Will Thompson 2012-11-02 11:57:57 UTC
(In reply to comment #1)
> + if (seconds_since_ping > priv->keepalive_interval *
> MISSED_KEEPALIVES_BEFORE_DISCONNECTING) {
> 
> I personally love as many brackets as possible to make everything clear.

I think http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=c679fe4baaec1c29f7d0fbbed1f6b1d9c7d1266c may be clearer, too?

> Otherwise looks great! What a nice easy branch to review, thanks!

Consider it merged: http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=27c1ffc5ebcfcb37ad958ef451ca2772bdc4ec01

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.