From: havoc Date: Thu, 14 Jun 2007 03:58:38 +0000 (+0000) Subject: reworked sendsignon logic so that unlimited sends are allowed once X-Git-Tag: xonotic-v0.1.0preview~3046 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=e41d0c1d5a96671a8337222ad74edb76c27e969f;p=xonotic%2Fdarkplaces.git reworked sendsignon logic so that unlimited sends are allowed once prespawn is sent by the client git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7415 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index 4920a35a..b69389c1 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1389,7 +1389,7 @@ void Host_PreSpawn_f (void) SZ_Write (&host_client->netconnection->message, sv.signon.data, sv.signon.cursize); MSG_WriteByte (&host_client->netconnection->message, svc_signonnum); MSG_WriteByte (&host_client->netconnection->message, 2); - host_client->sendsignon = true; // send this message, this will be cleared later + host_client->sendsignon = 0; // enable unlimited sends again } // reset the name change timer because the client will send name soon @@ -1533,7 +1533,6 @@ void Host_Spawn_f (void) MSG_WriteByte (&host_client->netconnection->message, svc_signonnum); MSG_WriteByte (&host_client->netconnection->message, 3); - host_client->sendsignon = true; // send this message, this will be cleared later } /* diff --git a/server.h b/server.h index a63d1232..730e7fcf 100644 --- a/server.h +++ b/server.h @@ -140,8 +140,8 @@ typedef struct client_s qboolean clientconnectcalled; // false = don't send datagrams qboolean spawned; - // false = don't send reliable messages until svc_signonnum 2 (before spawned is set) - qboolean sendsignon; + // 1 = send svc_serverinfo and advance to 2, 2 doesn't send, then advances to 0 (allowing unlimited sending) when prespawn is received + int sendsignon; // requested rate in bytes per second int rate; diff --git a/sv_main.c b/sv_main.c index 6c4516df..facd0dab 100644 --- a/sv_main.c +++ b/sv_main.c @@ -714,7 +714,7 @@ void SV_SendServerinfo (client_t *client) MSG_WriteByte (&client->netconnection->message, 1); client->spawned = false; // need prespawn, spawn, etc - client->sendsignon = true; // send this message, this will be cleared later + client->sendsignon = 1; // send this message, and increment to 2, 2 will be set to 0 by the prespawn command // clear movement info until client enters the new level properly memset(&client->cmd, 0, sizeof(client->cmd)); @@ -1684,9 +1684,9 @@ static void SV_SendClientDatagram (client_t *client) } // send the datagram - NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, !client->spawned && !client->sendsignon); - if (!client->netconnection->message.cursize) - client->sendsignon = false; + NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, client->sendsignon == 2); + if (client->sendsignon == 1 && !client->netconnection->message.cursize) + client->sendsignon = 2; // prevent reliable until client sends prespawn (this is the keepalive phase) } /*