]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
reworked sendsignon logic so that unlimited sends are allowed once
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Jun 2007 03:58:38 +0000 (03:58 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Jun 2007 03:58:38 +0000 (03:58 +0000)
prespawn is sent by the client

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7415 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c
server.h
sv_main.c

index 4920a35a330ac79ff513ab4db29479a9aff6db51..b69389c1d91ae43fd3145b51ba49274daf8eab13 100644 (file)
@@ -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
 }
 
 /*
index a63d12329ca98d8081582cba6d270c6fdd929dd6..730e7fcf2347090b0044380050f8a566f92da6ec 100644 (file)
--- 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;
index 6c4516dfedd4c9783c9433203250524db77b1326..facd0dabac503df32158197604a1a2693608d83b 100644 (file)
--- 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)
 }
 
 /*