foxygit / doom Log in
commit fea3b29487c305a535b7b270f220ef88dbadb908
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Wed Jan 30 18:42:01 2019 -0500
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Wed Jan 30 18:42:01 2019 -0500

    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.
---
 src/net_server.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/net_server.c b/src/net_server.c
index 6a3d818b..c9dd3d9b 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1681,6 +1681,18 @@ void NET_SV_CheckDeadlock(net_client_t *client)
                 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);
+        }
     }
 }