mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 05:41:02 +00:00
Reorder join process so password is authenticated before attempting to download
This commit is contained in:
parent
1fac0505a4
commit
b25acfa782
2 changed files with 24 additions and 40 deletions
|
@ -1995,41 +1995,8 @@ static boolean CL_FinishedFileList(void)
|
||||||
else if (i == 1)
|
else if (i == 1)
|
||||||
cl_mode = CL_ASKJOIN;
|
cl_mode = CL_ASKJOIN;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// must download something
|
|
||||||
// can we, though?
|
|
||||||
#ifdef HAVE_CURL
|
|
||||||
if (http_source[0] == '\0' || curl_failedwebdownload)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (!CL_CheckDownloadable()) // nope!
|
|
||||||
{
|
|
||||||
D_QuitNetGame();
|
|
||||||
CL_Reset();
|
|
||||||
D_StartTitle();
|
|
||||||
M_StartMessage(M_GetText(
|
|
||||||
"You cannot connect to this server\n"
|
|
||||||
"because you cannot download the files\n"
|
|
||||||
"that you are missing from the server.\n\n"
|
|
||||||
"See the console or log file for\n"
|
|
||||||
"more details.\n\n"
|
|
||||||
"Press ESC\n"
|
|
||||||
), NULL, MM_NOTHING);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cl_mode = CL_ASKDOWNLOADFILES;
|
cl_mode = CL_ASKDOWNLOADFILES;
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
#ifdef HAVE_CURL
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cl_mode = CL_PREPAREHTTPFILES;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called by CL_ServerConnectionTicker
|
/** Called by CL_ServerConnectionTicker
|
||||||
|
@ -2163,10 +2130,9 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
case CL_PREPAREHTTPFILES:
|
case CL_PREPAREHTTPFILES:
|
||||||
if (http_source[0])
|
|
||||||
{
|
{
|
||||||
for (i = 0; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
if (fileneeded[i].status == FS_NOTFOUND)
|
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
||||||
curl_transfers++;
|
curl_transfers++;
|
||||||
|
|
||||||
cl_mode = CL_DOWNLOADHTTPFILES;
|
cl_mode = CL_DOWNLOADHTTPFILES;
|
||||||
|
@ -2176,7 +2142,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
case CL_DOWNLOADHTTPFILES:
|
case CL_DOWNLOADHTTPFILES:
|
||||||
waitmore = false;
|
waitmore = false;
|
||||||
for (i = 0; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
if (fileneeded[i].status == FS_NOTFOUND)
|
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
||||||
{
|
{
|
||||||
if (!curl_running)
|
if (!curl_running)
|
||||||
CURLPrepareFile(http_source, i);
|
CURLPrepareFile(http_source, i);
|
||||||
|
@ -3912,7 +3878,9 @@ static void HandleConnect(SINT8 node)
|
||||||
if (netbuffer->u.clientcfg.needsdownload)
|
if (netbuffer->u.clientcfg.needsdownload)
|
||||||
{
|
{
|
||||||
netbuffer->packettype = PT_DOWNLOADFILESOKAY;
|
netbuffer->packettype = PT_DOWNLOADFILESOKAY;
|
||||||
HSendPacket(node, true, 0, 0);
|
strncpy(netbuffer->u.filecfg.http_source, cv_httpsource.string,
|
||||||
|
MAX_MIRROR_LENGTH);
|
||||||
|
HSendPacket(node, true, 0, sizeof netbuffer->u.filecfg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4193,7 +4161,17 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
|
|
||||||
SERVERONLY
|
SERVERONLY
|
||||||
|
|
||||||
// This should've already been checked, but just to be safe...
|
#ifdef HAVE_CURL
|
||||||
|
if (! curl_failedwebdownload &&
|
||||||
|
netbuffer->u.filecfg.http_source[0] != '\0'
|
||||||
|
){
|
||||||
|
strlcpy(http_source, netbuffer->u.filecfg.http_source,
|
||||||
|
MAX_MIRROR_LENGTH);
|
||||||
|
|
||||||
|
cl_mode = CL_PREPAREHTTPFILES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
if (!CL_CheckDownloadable())
|
if (!CL_CheckDownloadable())
|
||||||
{
|
{
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
|
@ -4215,7 +4193,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
|
|
||||||
cl_challengeattempted = 2;
|
cl_challengeattempted = 2;
|
||||||
CONS_Printf("trying to download\n");
|
CONS_Printf("trying to download\n");
|
||||||
if (CL_SendRequestFile())
|
if (cl_mode == CL_WAITDOWNLOADFILESRESPONSE && CL_SendRequestFile())
|
||||||
cl_mode = CL_DOWNLOADFILES;
|
cl_mode = CL_DOWNLOADFILES;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -443,6 +443,11 @@ typedef struct
|
||||||
UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
|
UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
|
||||||
} ATTRPACK filesneededconfig_pak;
|
} ATTRPACK filesneededconfig_pak;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char http_source[MAX_MIRROR_LENGTH];/* first byte 0? no die! */
|
||||||
|
} ATTRPACK fileconfig;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Network packet data
|
// Network packet data
|
||||||
//
|
//
|
||||||
|
@ -477,6 +482,7 @@ typedef struct
|
||||||
plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?)
|
plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?)
|
||||||
INT32 filesneedednum; // 4 bytes
|
INT32 filesneedednum; // 4 bytes
|
||||||
filesneededconfig_pak filesneededcfg; // ??? bytes
|
filesneededconfig_pak filesneededcfg; // ??? bytes
|
||||||
|
fileconfig filecfg;
|
||||||
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
|
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
|
||||||
} u; // This is needed to pack diff packet types data together
|
} u; // This is needed to pack diff packet types data together
|
||||||
} ATTRPACK doomdata_t;
|
} ATTRPACK doomdata_t;
|
||||||
|
|
Loading…
Reference in a new issue