]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
brought back the client->sendsignon flag from original quake code, this
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 13 Jun 2007 06:59:45 +0000 (06:59 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 13 Jun 2007 06:59:45 +0000 (06:59 +0000)
fixes the occasional error message on old clients when a level change
occurs and chat messages or scoreboard updates or other reliable
messages are delivered to the client when it is not expecting them
(during model/sound loading when it is supposed to just be exchanging
keepalive messages)

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

cl_input.c
cl_main.c
cl_parse.c
host.c
host_cmd.c
netconn.c
netconn.h
server.h
sv_main.c

index 88fb31323fb35c50d8bd215d4d63bab063d768db..a7254701e5eca670604fcb4079f16f95ce5fb459 100644 (file)
@@ -1569,7 +1569,7 @@ void CL_SendMove(void)
 
        // send the reliable message (forwarded commands) if there is one
        if (buf.cursize || cls.netcon->message.cursize)
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, max(20*(buf.cursize+40), cl_rate.integer));
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, max(20*(buf.cursize+40), cl_rate.integer), false);
 
        if (cls.netcon->message.overflowed)
        {
index 3b6061bc2e39974c74da672efce5584c1a14e8cb..ad928ca7db38f2f18a2c9f651549193997a65c5f 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -346,9 +346,9 @@ void CL_Disconnect(void)
                        Con_DPrint("Sending clc_disconnect\n");
                        MSG_WriteByte(&buf, clc_disconnect);
                }
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000);
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000);
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000);
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000, false);
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000, false);
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000, false);
                NetConn_Close(cls.netcon);
                cls.netcon = NULL;
        }
index 1a85027fd76f292ef16804f73e43654e10b0a02e..5f41466ea59789df7e1fe5781f73862df16ae57f 100644 (file)
@@ -287,7 +287,7 @@ void CL_KeepaliveMessage (qboolean readmessages)
        sizebuf_t old;
 
        // no need if server is local and definitely not if this is a demo
-       if (sv.active || !cls.netcon || cls.protocol == PROTOCOL_QUAKEWORLD)
+       if (!cls.netcon || cls.protocol == PROTOCOL_QUAKEWORLD)
                return;
 
        if (readmessages)
@@ -318,7 +318,7 @@ void CL_KeepaliveMessage (qboolean readmessages)
                msg.data = buf;
                msg.maxsize = sizeof(buf);
                MSG_WriteChar(&msg, clc_nop);
-               NetConn_SendUnreliableMessage(cls.netcon, &msg, cls.protocol, 10000);
+               NetConn_SendUnreliableMessage(cls.netcon, &msg, cls.protocol, 10000, false);
        }
 }
 
diff --git a/host.c b/host.c
index 812a2cb63ac022ec015b0620f71fef30ed205fd1..0a4df3d0ba540417d126d9c14ae4878675b4a851 100644 (file)
--- a/host.c
+++ b/host.c
@@ -386,9 +386,9 @@ void SV_DropClient(qboolean crash)
                        buf.data = bufdata;
                        buf.maxsize = sizeof(bufdata);
                        MSG_WriteByte(&buf, svc_disconnect);
-                       NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000);
-                       NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000);
-                       NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000);
+                       NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, false);
+                       NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, false);
+                       NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, false);
                }
                // break the net connection
                NetConn_Close(host_client->netconnection);
index bcdd0cf3a62155b49cf6c2d9d23fa80d6cac7d54..f37626bd9701ea9502788374aeffda2e40961890 100644 (file)
@@ -1364,6 +1364,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
        }
 
        // reset the name change timer because the client will send name soon
@@ -1507,6 +1508,7 @@ 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 fdf72bbe988474ff64458d26e50b7287bf0dcdbc..9e62d93c7050fa3e14d06a14bd912fc39e3e029d 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -505,7 +505,7 @@ qboolean NetConn_CanSend(netconn_t *conn)
        }
 }
 
-int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate)
+int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate, qboolean quakesignon_suppressreliables)
 {
        int totallen = 0;
 
@@ -622,7 +622,7 @@ int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolvers
                }
 
                // if we have a new reliable message to send, do so
-               if (!conn->sendMessageLength && conn->message.cursize)
+               if (!conn->sendMessageLength && conn->message.cursize && !quakesignon_suppressreliables)
                {
                        if (conn->message.cursize > (int)sizeof(conn->sendMessage))
                        {
@@ -1179,7 +1179,7 @@ void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_t *peer
                msg.data = buf;
                msg.maxsize = sizeof(buf);
                MSG_WriteChar(&msg, clc_nop);
-               NetConn_SendUnreliableMessage(cls.netcon, &msg, cls.protocol, 10000);
+               NetConn_SendUnreliableMessage(cls.netcon, &msg, cls.protocol, 10000, false);
        }
 }
 
index b686aad9ddc6fa6adb74dbec8956f20444623694..d875e7a81d5e3f40f18d57f314b686d1b63b7384 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -350,7 +350,7 @@ extern cvar_t net_address;
 //extern cvar_t net_netaddress_ipv6;
 
 qboolean NetConn_CanSend(netconn_t *conn);
-int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate);
+int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate, qboolean quakesignon_suppressreliables);
 void NetConn_CloseClientPorts(void);
 void NetConn_OpenClientPorts(void);
 void NetConn_CloseServerPorts(void);
index e32c35500d4b5e0386afd50678ba797c905c41ef..a63d12329ca98d8081582cba6d270c6fdd929dd6 100644 (file)
--- a/server.h
+++ b/server.h
@@ -140,6 +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;
 
        // requested rate in bytes per second
        int rate;
index 3d9e091b8b0d39c1ed06a68754bec74bca52ee1d..47b474e5b85da6976dfb4bd9a40982c92c102094 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -714,6 +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
 
        // clear movement info until client enters the new level properly
        memset(&client->cmd, 0, sizeof(client->cmd));
@@ -1620,7 +1621,7 @@ static void SV_SendClientDatagram (client_t *client)
        if (!NetConn_CanSend(client->netconnection))
        {
                // send the datagram
-               //NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate);
+               //NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, true);
                return;
        }
        else if (host_client->spawned)
@@ -1681,7 +1682,9 @@ static void SV_SendClientDatagram (client_t *client)
        }
 
 // send the datagram
-       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate);
+       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, !client->spawned && !client->sendsignon);
+       if (!client->netconnection->message.cursize)
+               client->sendsignon = false;
 }
 
 /*