Kick clients if they take too long to download a Lua file
This commit is contained in:
parent
b6e5837161
commit
854e43ea7c
|
@ -570,6 +570,7 @@ static void SV_PrepareSendLuaFileToNextNode(void)
|
||||||
I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol
|
I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol
|
||||||
|
|
||||||
luafiletransfers->nodestatus[i] = LFTNS_ASKED;
|
luafiletransfers->nodestatus[i] = LFTNS_ASKED;
|
||||||
|
luafiletransfers->nodetimeouts[i] = I_GetTime() + 30 * TICRATE;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -930,6 +931,22 @@ void FileSendTicker(void)
|
||||||
filetx_t *f;
|
filetx_t *f;
|
||||||
INT32 packetsent, ram, i, j;
|
INT32 packetsent, ram, i, j;
|
||||||
|
|
||||||
|
// If someone is taking too long to download, kick them with a timeout
|
||||||
|
// to prevent blocking the rest of the server...
|
||||||
|
if (luafiletransfers)
|
||||||
|
{
|
||||||
|
for (i = 1; i < MAXNETNODES; i++)
|
||||||
|
{
|
||||||
|
luafiletransfernodestatus_t status = luafiletransfers->nodestatus[i];
|
||||||
|
|
||||||
|
if (status != LFTNS_NONE && status != LFTNS_WAITING && status != LFTNS_SENT
|
||||||
|
&& I_GetTime() > luafiletransfers->nodetimeouts[i])
|
||||||
|
{
|
||||||
|
Net_ConnectionTimeout(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!filestosend) // No file to send
|
if (!filestosend) // No file to send
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ typedef struct luafiletransfer_s
|
||||||
INT32 id; // Callback ID
|
INT32 id; // Callback ID
|
||||||
boolean ongoing;
|
boolean ongoing;
|
||||||
luafiletransfernodestatus_t nodestatus[MAXNETNODES];
|
luafiletransfernodestatus_t nodestatus[MAXNETNODES];
|
||||||
|
tic_t nodetimeouts[MAXNETNODES];
|
||||||
struct luafiletransfer_s *next;
|
struct luafiletransfer_s *next;
|
||||||
} luafiletransfer_t;
|
} luafiletransfer_t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue