summary refs log tree commit diff stats
path: root/src/fe-gtk/fe-gtk.c
diff options
context:
space:
mode:
authorDiogo Sousa <diogogsousa@gmail.com>2013-04-09 20:54:22 +0100
committerArnav Singh <arnavion@gmail.com>2013-04-09 19:14:46 -0700
commit36694afe0e28eff7d8fb3d6f012d249b73a9ac77 (patch)
treee1493cab83a755c646b9bd27d4159562d412f974 /src/fe-gtk/fe-gtk.c
parenta99111172dba67879e6e8dfdba3385872159cecd (diff)
Don't send ping's to the server if we are still waiting for a pong.
If the server don't respond in 30s just report the lag as +30s.

This fixes the bug where hexchat reset the lag meter every time a ping
was sent and no pong was received.
Diffstat (limited to 'src/fe-gtk/fe-gtk.c')
-rw-r--r--src/fe-gtk/fe-gtk.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index deefb788..d87ccd4e 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -735,6 +735,10 @@ fe_set_lag (server *serv, int lag)
 		lag = (nowtim - serv->lag_sent) / 100000;
 	}
 
+	/* if there is no pong for >30s report the lag as +30s */
+	if (lag > 300 && serv->lag_sent)
+		lag=300;
+
 	per = (double)((double)lag / (double)10);
 	if (per > 1.0)
 		per = 1.0;