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.
This commit is contained in:
Simon Howard 2019-01-30 18:31:08 -05:00
parent 945355d29f
commit b8656b5283

View file

@ -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)