mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-30 07:41:45 +00:00
increased the fast map download time-out to 2 seconds
This commit is contained in:
parent
7020abd4a8
commit
37e2b07e5a
1 changed files with 6 additions and 7 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue