telepathy-idle: Clarify ping timeout comparison

Will Thompson wjt at kemper.freedesktop.org
Fri Nov 2 04:56:49 PDT 2012


Module: telepathy-idle
Branch: master
Commit: c679fe4baaec1c29f7d0fbbed1f6b1d9c7d1266c
URL:    http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=c679fe4baaec1c29f7d0fbbed1f6b1d9c7d1266c

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Fri Nov  2 11:55:53 2012 +0000

Clarify ping timeout comparison

Jonny wanted this to be clearer on
<https://bugs.freedesktop.org/show_bug.cgi?id=56589#c1>.

---

 src/idle-connection.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/idle-connection.c b/src/idle-connection.c
index 07adc92..29967c6 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -832,8 +832,9 @@ static gboolean keepalive_timeout_cb(gpointer user_data) {
 
 	if (priv->ping_time != 0) {
 		gint64 seconds_since_ping = (now - priv->ping_time) / G_USEC_PER_SEC;
+		gint64 grace_period = priv->keepalive_interval * MISSED_KEEPALIVES_BEFORE_DISCONNECTING;
 
-		if (seconds_since_ping > priv->keepalive_interval * MISSED_KEEPALIVES_BEFORE_DISCONNECTING) {
+		if (seconds_since_ping > grace_period) {
 			IDLE_DEBUG("haven't heard from the server in %" G_GINT64_FORMAT " seconds "
 				"(more than %u keepalive intervals)",
 				seconds_since_ping, MISSED_KEEPALIVES_BEFORE_DISCONNECTING);



More information about the telepathy-commits mailing list