From 084a75e0978e78cc092243e574685a22b73df5f9 Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 11 Feb 2006 04:21:51 +0000 Subject: [PATCH] minor cleanup of keepalive git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5961 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index f1cc56c1..78f2589a 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -173,7 +173,7 @@ static unsigned char olddata[NET_MAXMESSAGE]; void CL_KeepaliveMessage (void) { float time; - static float lastmsg; + static double nextmsg = -1; int oldreadcount; qboolean oldbadread; sizebuf_t old; @@ -195,17 +195,17 @@ void CL_KeepaliveMessage (void) net_message = old; memcpy(net_message.data, olddata, net_message.cursize); - if (cls.netcon && NetConn_CanSendMessage(cls.netcon) && (time = Sys_DoubleTime()) - lastmsg >= 5) + if (cls.netcon && (time = Sys_DoubleTime()) >= nextmsg) { sizebuf_t msg; unsigned char buf[4]; - lastmsg = time; + nextmsg = time + 5; // write out a nop // LordHavoc: must use unreliable because reliable could kill the sigon message! Con_Print("--> client to server keepalive\n"); + memset(&msg, 0, sizeof(msg)); msg.data = buf; msg.maxsize = sizeof(buf); - msg.cursize = 0; MSG_WriteChar(&msg, svc_nop); NetConn_SendUnreliableMessage(cls.netcon, &msg); } -- 2.39.2