increased the fast map download time-out to 2 seconds

This commit is contained in:
myT 2018-01-07 14:32:12 +01:00
parent 7020abd4a8
commit 37e2b07e5a

View file

@ -36,6 +36,9 @@ typedef int SOCKET;
#endif #endif
#define MAX_TIMEOUT_MS 2000
struct mapDownload_t { struct mapDownload_t {
char recBuffer[1 << 20]; // for both download data and checksumming char recBuffer[1 << 20]; // for both download data and checksumming
char tempMessage[MAXPRINTMSG]; // for PrintError char tempMessage[MAXPRINTMSG]; // for PrintError
@ -481,9 +484,7 @@ static qbool ParseHeader( unsigned int* headerLength, mapDownload_t* dl )
// note: sscanf %s with the width specifier will null terminate in overflow cases too // note: sscanf %s with the width specifier will null terminate in overflow cases too
#define MAXSTRLEN 512 #define MAXSTRLEN 512
#define STR(X) #X #define WSPEC XSTRING(MAXSTRLEN)
#define XSTR(X) STR(X)
#define WSPEC XSTR(MAXSTRLEN)
static char httpHeaderValue[MAXSTRLEN]; static char httpHeaderValue[MAXSTRLEN];
static char header[MAXSTRLEN]; static char header[MAXSTRLEN];
@ -570,8 +571,6 @@ static qbool ParseHeader( unsigned int* headerLength, mapDownload_t* dl )
return qtrue; return qtrue;
#undef WSPEC #undef WSPEC
#undef XSTR
#undef STR
#undef MAXSTRLEN #undef MAXSTRLEN
} }
@ -589,8 +588,8 @@ int Download_Continue( mapDownload_t* dl )
const int now = Sys_Milliseconds(); const int now = Sys_Milliseconds();
if (!dl->lastErrorTimeOut) if (!dl->lastErrorTimeOut)
dl->timeOutStartTimeMS = now; dl->timeOutStartTimeMS = now;
if (now - dl->timeOutStartTimeMS >= 1000) { if (now - dl->timeOutStartTimeMS >= MAX_TIMEOUT_MS) {
PrintError(dl, "Timed out for more than a full second"); PrintError(dl, "Timed out for more than " XSTRING(MAX_TIMEOUT_MS) "ms");
Download_CleanUp(dl, qfalse); Download_CleanUp(dl, qfalse);
return MDLS_ERROR; return MDLS_ERROR;
} }