mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Merge branch 'master' of https://github.com/Edward850/zdoom
This commit is contained in:
commit
853c1c4f1e
2 changed files with 45 additions and 35 deletions
|
@ -1747,6 +1747,8 @@ void TryRunTics (void)
|
||||||
|
|
||||||
if (counts == 0 && !doWait)
|
if (counts == 0 && !doWait)
|
||||||
{
|
{
|
||||||
|
// Check possible stall conditions
|
||||||
|
Net_CheckLastRecieved(counts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1824,41 +1826,8 @@ void TryRunTics (void)
|
||||||
if (lowtic < gametic)
|
if (lowtic < gametic)
|
||||||
I_Error ("TryRunTics: lowtic < gametic");
|
I_Error ("TryRunTics: lowtic < gametic");
|
||||||
|
|
||||||
// [Ed850] Check to see the last time a packet was recieved.
|
// Check possible stall conditions
|
||||||
// If it's longer then 3 seconds, a node has likely stalled.
|
Net_CheckLastRecieved (counts);
|
||||||
if(I_GetTime(false) - lastglobalrecvtime >= TICRATE*3)
|
|
||||||
{
|
|
||||||
lastglobalrecvtime = I_GetTime(false); //Bump the count
|
|
||||||
|
|
||||||
if(NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator)
|
|
||||||
{
|
|
||||||
//Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late.
|
|
||||||
//However, we don't send a resend request for sanity reasons.
|
|
||||||
for (i = 0; i < doomcom.numnodes; i++)
|
|
||||||
{
|
|
||||||
if (nodeingame[i] && nettics[i] < gametic + counts)
|
|
||||||
{
|
|
||||||
if (debugfile)
|
|
||||||
fprintf (debugfile, "%i is slow (%i to %i)\n",
|
|
||||||
i, nettics[i], gametic+counts);
|
|
||||||
//Send resend request to the late node. Also mark the node as waiting to display it in the hud.
|
|
||||||
if(i != 0)
|
|
||||||
remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
players[playerfornode[i]].waiting = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ //Send a resend request to the Arbitrator, as it's obvious we are stuck here.
|
|
||||||
if (debugfile)
|
|
||||||
fprintf (debugfile, "Arbitrator is slow (%i to %i)\n",
|
|
||||||
nettics[Net_Arbitrator], gametic+counts);
|
|
||||||
//Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud.
|
|
||||||
if(i != 0)
|
|
||||||
remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't stay in here forever -- give the menu a chance to work
|
// don't stay in here forever -- give the menu a chance to work
|
||||||
if (I_GetTime (false) - entertic >= TICRATE/3)
|
if (I_GetTime (false) - entertic >= TICRATE/3)
|
||||||
|
@ -1901,6 +1870,44 @@ void TryRunTics (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Net_CheckLastRecieved (int counts)
|
||||||
|
{
|
||||||
|
// [Ed850] Check to see the last time a packet was recieved.
|
||||||
|
// If it's longer then 3 seconds, a node has likely stalled.
|
||||||
|
if (I_GetTime(false) - lastglobalrecvtime >= TICRATE * 3)
|
||||||
|
{
|
||||||
|
lastglobalrecvtime = I_GetTime(false); //Bump the count
|
||||||
|
|
||||||
|
if (NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator)
|
||||||
|
{
|
||||||
|
//Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late.
|
||||||
|
//However, we don't send a resend request for sanity reasons.
|
||||||
|
for (int i = 0; i < doomcom.numnodes; i++)
|
||||||
|
{
|
||||||
|
if (nodeingame[i] && nettics[i] <= gametic + counts)
|
||||||
|
{
|
||||||
|
if (debugfile && !players[playerfornode[i]].waiting)
|
||||||
|
fprintf(debugfile, "%i is slow (%i to %i)\n",
|
||||||
|
i, nettics[i], gametic + counts);
|
||||||
|
//Send resend request to the late node. Also mark the node as waiting to display it in the hud.
|
||||||
|
if (i != 0)
|
||||||
|
remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
players[playerfornode[i]].waiting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //Send a resend request to the Arbitrator, as it's obvious we are stuck here.
|
||||||
|
if (debugfile && !players[playerfornode[Net_Arbitrator]].waiting)
|
||||||
|
fprintf(debugfile, "Arbitrator is slow (%i to %i)\n",
|
||||||
|
nettics[Net_Arbitrator], gametic + counts);
|
||||||
|
//Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud.
|
||||||
|
remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Net_NewMakeTic (void)
|
void Net_NewMakeTic (void)
|
||||||
{
|
{
|
||||||
specials.NewMakeTic ();
|
specials.NewMakeTic ();
|
||||||
|
|
|
@ -115,6 +115,9 @@ void D_QuitNetGame (void);
|
||||||
//? how many ticks to run?
|
//? how many ticks to run?
|
||||||
void TryRunTics (void);
|
void TryRunTics (void);
|
||||||
|
|
||||||
|
//Use for checking to see if the netgame has stalled
|
||||||
|
void Net_CheckLastRecieved(int);
|
||||||
|
|
||||||
// [RH] Functions for making and using special "ticcmds"
|
// [RH] Functions for making and using special "ticcmds"
|
||||||
void Net_NewMakeTic ();
|
void Net_NewMakeTic ();
|
||||||
void Net_WriteByte (BYTE);
|
void Net_WriteByte (BYTE);
|
||||||
|
|
Loading…
Reference in a new issue