shithub: choc

Download patch

ref: fea3b29487c305a535b7b270f220ef88dbadb908
parent: b8656b5283c8a5beb2b397335af3ce7034d46651
author: Simon Howard <fraggle@soulsphere.org>
date: Wed Jan 30 13:42:01 EST 2019

net: Trigger resends from server in deadlock scenario.

The previous commit fixed the deadlock problem but if playing with older
clients it can still occur. Add a fix for it on the server side too so the
problem is guarded against on both ends.

--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1681,6 +1681,18 @@
                 break;
             }
         }
+
+        // If we sent a resend request to break the deadlock, also trigger a
+        // resend of any tics we have sitting in the send queue, in case the
+        // client is blocked waiting on tics from us that have been lost.
+        // This fixes deadlock with some older clients which do not send
+        // resends to break deadlock.
+        if (i < BACKUPTICS && client->sendseq > client->acknowledged)
+        {
+            NET_Log("server: also resending tics %d-%d to break deadlock",
+                    client->acknowledged, client->sendseq - 1);
+            NET_SV_SendTics(client, client->acknowledged, client->sendseq - 1);
+        }
     }
 }