shithub: choc

Download patch

ref: 19b8c7428afd6a42485a76bdf938e686e8450543
parent: 8b08253a0da0d081348c8755ec8a07977726de2b
author: Simon Howard <fraggle@gmail.com>
date: Thu Feb 23 13:20:29 EST 2006

Fix bugs in resend code for server->client data

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 377

--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_client.c 375 2006-02-22 18:35:55Z fraggle $
+// $Id: net_client.c 377 2006-02-23 18:20:29Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.28  2006/02/23 18:20:29  fraggle
+// Fix bugs in resend code for server->client data
+//
 // Revision 1.27  2006/02/22 18:35:55  fraggle
 // Packet resends for server->client gamedata
 //
@@ -552,12 +555,15 @@
     net_packet_t *packet;
     unsigned int nowtime;
     int i;
+
+    //printf("CL: Send resend %i-%i\n", start, end);
     
     packet = NET_NewPacket(64);
     NET_WriteInt16(packet, NET_PACKET_TYPE_GAMEDATA_RESEND);
     NET_WriteInt32(packet, start);
-    NET_WriteInt8(packet, end - start - 1);
+    NET_WriteInt8(packet, end - start + 1);
     NET_Conn_SendPacket(&client_connection, packet);
+    NET_FreePacket(packet);
 
     nowtime = I_GetTimeMS();
 
@@ -567,7 +573,7 @@
     {
         int index;
 
-        index = start - recvwindow_start;
+        index = i - recvwindow_start;
 
         if (index < 0 || index >= BACKUPTICS)
             continue;
@@ -631,6 +637,7 @@
 
     if (resend_start >= 0)
     {
+        //printf("CL: resend request timed out: %i-%i\n", resend_start, resend_end);
         NET_CL_SendResendRequest(recvwindow_start + resend_start,
                                  recvwindow_start + resend_end);
     }
@@ -669,7 +676,7 @@
 
         index = seq - recvwindow_start + i;
 
-        if (!NET_ReadFullTiccmd(packet, &cmd))
+        if (!NET_ReadFullTiccmd(packet, &cmd, false))
         {
             return;
         }
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_server.c 375 2006-02-22 18:35:55Z fraggle $
+// $Id: net_server.c 377 2006-02-23 18:20:29Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.30  2006/02/23 18:20:29  fraggle
+// Fix bugs in resend code for server->client data
+//
 // Revision 1.29  2006/02/22 18:35:55  fraggle
 // Packet resends for server->client gamedata
 //
@@ -920,7 +923,7 @@
 
         // Add command
        
-        NET_WriteFullTiccmd(packet, cmd);
+        NET_WriteFullTiccmd(packet, cmd, false);
     }
     
     // Send packet
@@ -945,6 +948,8 @@
         return;
     }
 
+    //printf("SV: %p: resend %i-%i\n", client, start, start+num_tics-1);
+
     // Resend those tics
 
     NET_SV_SendTics(client, start, start + num_tics - 1);
@@ -1124,7 +1129,7 @@
         }
     }
 
-    //printf("have complete ticcmd for %i\n", client->sendseq);
+    //printf("SV: have complete ticcmd for %i\n", client->sendseq);
 
     // We have all data we need to generate a command for this tic.