From: havoc Date: Wed, 28 May 2003 13:57:47 +0000 (+0000) Subject: got rid of my attempts to delay sending the ServerInfo packet until the first message... X-Git-Tag: xonotic-v0.1.0preview~6601 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3690c573771a6c248b597782de0cfb129c3b488d;p=xonotic%2Fdarkplaces.git got rid of my attempts to delay sending the ServerInfo packet until the first message from the client, because the ServerInfo packet is already handled by the quake reliable message system and thus will be re-sent multiple times... back to the drawing board on my attempts to fix quake through NAT routers git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3059 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/server.h b/server.h index b9f3aa86..363a5757 100644 --- 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; diff --git a/sv_main.c b/sv_main.c index ca6f27ab..3919ddde 100644 --- 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) diff --git a/sv_user.c b/sv_user.c index 4b7d68a7..91f4ff34 100644 --- 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)