]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added MAX_PACKETFRAGMENT to limit size of reliable packets, and also try to keep...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 Jul 2003 05:13:27 +0000 (05:13 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 Jul 2003 05:13:27 +0000 (05:13 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3338 d7cf8633-e32d-0410-b094-e92efae38249

netconn.c
quakedef.h
sv_main.c

index 363fbb9e1d0314b6798aeeb6ae8ed12d37ec61b4..c7dc533667e7b1cf221fd147f815ee9aca03950c 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -143,14 +143,14 @@ int NetConn_SendReliableMessage(netconn_t *conn, sizebuf_t *data)
        memcpy(conn->sendMessage, data->data, data->cursize);
        conn->sendMessageLength = data->cursize;
 
-       if (conn->sendMessageLength <= MAX_DATAGRAM)
+       if (conn->sendMessageLength <= MAX_PACKETFRAGMENT)
        {
                dataLen = conn->sendMessageLength;
                eom = NETFLAG_EOM;
        }
        else
        {
-               dataLen = MAX_DATAGRAM;
+               dataLen = MAX_PACKETFRAGMENT;
                eom = 0;
        }
 
@@ -182,14 +182,14 @@ static void NetConn_SendMessageNext(netconn_t *conn)
 
        if (conn->sendMessageLength && !conn->canSend && conn->sendNext)
        {
-               if (conn->sendMessageLength <= MAX_DATAGRAM)
+               if (conn->sendMessageLength <= MAX_PACKETFRAGMENT)
                {
                        dataLen = conn->sendMessageLength;
                        eom = NETFLAG_EOM;
                }
                else
                {
-                       dataLen = MAX_DATAGRAM;
+                       dataLen = MAX_PACKETFRAGMENT;
                        eom = 0;
                }
 
@@ -220,14 +220,14 @@ static void NetConn_ReSendMessage(netconn_t *conn)
 
        if (conn->sendMessageLength && !conn->canSend && (realtime - conn->lastSendTime) > 1.0)
        {
-               if (conn->sendMessageLength <= MAX_DATAGRAM)
+               if (conn->sendMessageLength <= MAX_PACKETFRAGMENT)
                {
                        dataLen = conn->sendMessageLength;
                        eom = NETFLAG_EOM;
                }
                else
                {
-                       dataLen = MAX_DATAGRAM;
+                       dataLen = MAX_PACKETFRAGMENT;
                        eom = 0;
                }
 
@@ -479,10 +479,10 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length)
                                                        Con_DPrintf("ack sequencing error\n");
                                                conn->lastMessageTime = realtime;
                                                conn->timeout = realtime + net_messagetimeout.value;
-                                               conn->sendMessageLength -= MAX_DATAGRAM;
+                                               conn->sendMessageLength -= MAX_PACKETFRAGMENT;
                                                if (conn->sendMessageLength > 0)
                                                {
-                                                       memcpy(conn->sendMessage, conn->sendMessage+MAX_DATAGRAM, conn->sendMessageLength);
+                                                       memcpy(conn->sendMessage, conn->sendMessage+MAX_PACKETFRAGMENT, conn->sendMessageLength);
                                                        conn->sendNext = true;
                                                        NetConn_SendMessageNext(conn);
                                                }
index bd9ca3c10439fb83ff650ede8748ef1e9d3a58f5..4ab90481a1b6d0163135daade6eef0a7115941cd 100644 (file)
@@ -45,6 +45,7 @@ extern char *buildstring;
 
 #define        ON_EPSILON              0.1                     // point on plane side epsilon
 
+#define MAX_PACKETFRAGMENT 1024                // max length of packet fragment
 // LordHavoc: this was 1024, now 65536
 #define        MAX_DATAGRAM    65536           // max length of unreliable
 #define        MAX_NETRELIABLE 65536           // max length of reliable message (fragments into unreliable packets)
index d9fb0507e6b0177c31703ce4b61346a0a3f5e39a..d7db4ef9c39e2d4c9e5ee60fc0e6ee05a7a393e1 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -94,7 +94,7 @@ void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
 {
        int             i, v;
 
-       if (sv.datagram.cursize > MAX_DATAGRAM-16)
+       if (sv.datagram.cursize > MAX_PACKETFRAGMENT-18)
                return;
        MSG_WriteByte (&sv.datagram, svc_particle);
        MSG_WriteDPCoord (&sv.datagram, org[0]);
@@ -122,10 +122,10 @@ Make sure the event gets sent to all clients
 */
 void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount, int framerate)
 {
-       if (sv.datagram.cursize > MAX_DATAGRAM-18)
-               return;
        if (modelindex >= 256 || startframe >= 256)
        {
+               if (sv.datagram.cursize > MAX_PACKETFRAGMENT-19)
+                       return;
                MSG_WriteByte (&sv.datagram, svc_effect2);
                MSG_WriteDPCoord (&sv.datagram, org[0]);
                MSG_WriteDPCoord (&sv.datagram, org[1]);
@@ -137,6 +137,8 @@ void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount,
        }
        else
        {
+               if (sv.datagram.cursize > MAX_PACKETFRAGMENT-17)
+                       return;
                MSG_WriteByte (&sv.datagram, svc_effect);
                MSG_WriteDPCoord (&sv.datagram, org[0]);
                MSG_WriteDPCoord (&sv.datagram, org[1]);
@@ -176,7 +178,7 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, floa
        if (channel < 0 || channel > 7)
                Host_Error ("SV_StartSound: channel = %i", channel);
 
-       if (sv.datagram.cursize > MAX_DATAGRAM-16)
+       if (sv.datagram.cursize > MAX_PACKETFRAGMENT-21)
                return;
 
 // find precache number for sound