]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
got rid of my attempts to delay sending the ServerInfo packet until the first message...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 28 May 2003 13:57:47 +0000 (13:57 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 28 May 2003 13:57:47 +0000 (13:57 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3059 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_main.c
sv_user.c

index b9f3aa86576ecc1ab392a2ceabdcd0831f41de0c..363a57577af22b20d11e26eeca9e75523289153c 100644 (file)
--- a/server.h
+++ b/server.h
@@ -109,12 +109,6 @@ typedef struct client_s
        // only valid before spawned
        qboolean sendsignon;
 
-       // LordHavoc: to make netquake protocol get through NAT routers, have to wait for client to ack
-       // waiting for connect from client (stage 1)
-       qboolean waitingforconnect;
-       // send server info in next datagram (stage 2)
-       qboolean sendserverinfo;
-
        // reliable messages must be sent periodically
        double last_message;
 
index ca6f27ab3a4e428c3ac367d6edd7a0321674996b..3919dddecde528267262eac769133edf3c2185f0 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -249,7 +249,7 @@ This will be sent on the initial connection and upon each server load.
 void SV_SendServerinfo (client_t *client)
 {
        char                    **s;
-       char                    message[2048];
+       char                    message[128];
 
        // LordHavoc: clear entityframe tracking
        client->entityframenumber = 0;
@@ -268,9 +268,7 @@ void SV_SendServerinfo (client_t *client)
        else
                MSG_WriteByte (&client->message, GAME_COOP);
 
-       sprintf (message, PR_GetString(sv.edicts->v->message));
-
-       MSG_WriteString (&client->message,message);
+       MSG_WriteString (&client->message,PR_GetString(sv.edicts->v->message));
 
        for (s = sv.model_precache+1 ; *s ; s++)
                MSG_WriteString (&client->message, *s);
@@ -291,6 +289,9 @@ void SV_SendServerinfo (client_t *client)
 
        MSG_WriteByte (&client->message, svc_signonnum);
        MSG_WriteByte (&client->message, 1);
+
+       client->sendsignon = true;
+       client->spawned = false;                // need prespawn, spawn, etc
 }
 
 /*
@@ -338,10 +339,7 @@ void SV_ConnectClient (int clientnum)
                        client->spawn_parms[i] = (&pr_global_struct->parm1)[i];
        }
 
-       client->spawned = false;                // need prespawn, spawn, etc
-       client->waitingforconnect = true;
-       client->sendserverinfo = false;
-       client->sendsignon = true;
+       SV_SendServerinfo (client);
 }
 
 
@@ -871,9 +869,6 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg)
        model_t *model;
        entity_state_t *s;
 
-       if (client->sendsignon)
-               return;
-
        Mod_CheckLoaded(sv.worldmodel);
 
 // find the client's PVS
@@ -1387,17 +1382,14 @@ qboolean SV_SendClientDatagram (client_t *client)
        MSG_WriteByte (&msg, svc_time);
        MSG_WriteFloat (&msg, sv.time);
 
-       if (client->spawned)
-       {
-               // add the client specific data to the datagram
-               SV_WriteClientdataToMessage (client->edict, &msg);
+       // add the client specific data to the datagram
+       SV_WriteClientdataToMessage (client->edict, &msg);
 
-               SV_WriteEntitiesToClient (client, client->edict, &msg);
+       SV_WriteEntitiesToClient (client, client->edict, &msg);
 
-               // copy the server datagram if there is space
-               if (msg.cursize + sv.datagram.cursize < msg.maxsize)
-                       SZ_Write (&msg, sv.datagram.data, sv.datagram.cursize);
-       }
+       // copy the server datagram if there is space
+       if (msg.cursize + sv.datagram.cursize < msg.maxsize)
+               SZ_Write (&msg, sv.datagram.data, sv.datagram.cursize);
 
 // send the datagram
        if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1)
@@ -1503,12 +1495,6 @@ void SV_SendClientMessages (void)
                // send a full message when the next signon stage has been requested
                // some other message data (name changes, etc) may accumulate
                // between signon stages
-                       if (host_client->sendserverinfo)
-                       {
-                               Con_DPrintf("SV_SendClientMessages: sending server info to new client\n");
-                               SV_SendServerinfo (host_client);
-                               host_client->sendserverinfo = false;
-                       }
                        if (!host_client->sendsignon)
                        {
                                if (realtime - host_client->last_message > 5)
index 4b7d68a79e9987e7eaae8edfce9cb435e23d2833..91f4ff345936763c28b742b74d796fd45fda4624 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -540,13 +540,6 @@ nextmsg:
                if (!ret)
                        return true;
 
-               if (host_client->waitingforconnect)
-               {
-                       Con_DPrintf ("SV_ReadClientMessage: setting sendserverinfo to true\n");
-                       host_client->waitingforconnect = false;
-                       host_client->sendserverinfo = true;
-               }
-
                MSG_BeginReading ();
 
                while (1)