commit b8656b5283c8a5beb2b397335af3ce7034d46651
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Wed Jan 30 18:31:08 2019 -0500
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Wed Jan 30 18:34:04 2019 -0500
net: Send resend requests to server on deadlock.
The server already triggers resend requests if it detects a potential
deadlock has occurred, but the same scenario can occur if one of the
clients loses enough game data packets from the server. So detect this
on the client side too and trigger artificial resend requests.
Big thanks go to MadDog and Mortrixs for providing network logs of
the deadlock occurring which allowed me to figure out the cause.
---
src/net_client.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/net_client.c b/src/net_client.c
index 44601a11..62915eab 100644
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -611,8 +611,10 @@ static void NET_CL_CheckResends(void)
int i;
int resend_start, resend_end;
unsigned int nowtime;
+ boolean maybe_deadlocked;
nowtime = I_GetTimeMS();
+ maybe_deadlocked = nowtime - gamedata_recv_time > 1000;
resend_start = -1;
resend_end = -1;
@@ -631,15 +633,26 @@ static void NET_CL_CheckResends(void)
&& recvobj->resend_time != 0
&& nowtime > recvobj->resend_time + 300;
+ // if no game data has been received in a long time, we may be in
+ // a deadlock scenario where tics from the server have been lost, so
+ // we've stopped generating any more, so the server isn't sending us
+ // any, so we don't get any to trigger a resend request. So force the
+ // first few tics in the receive window to be requested.
+ if (i == 0 && !recvobj->active && recvobj->resend_time == 0
+ && maybe_deadlocked)
+ {
+ need_resend = true;
+ }
+
if (need_resend)
{
// Start a new run of resend tics?
-
+
if (resend_start < 0)
{
resend_start = i;
}
-
+
resend_end = i;
}
else if (resend_start >= 0)