Revert "Reorder join process so password is authenticated before attempting to download"

This reverts commit b25acfa782.
This commit is contained in:
James R 2020-04-26 01:12:40 -07:00
parent 10582beb2a
commit bb3dcf7d5f
2 changed files with 40 additions and 24 deletions

View File

@ -2012,8 +2012,41 @@ 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
@ -2147,9 +2180,10 @@ 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 || fileneeded[i].status == FS_MD5SUMBAD) if (fileneeded[i].status == FS_NOTFOUND)
curl_transfers++; curl_transfers++;
cl_mode = CL_DOWNLOADHTTPFILES; cl_mode = CL_DOWNLOADHTTPFILES;
@ -2159,7 +2193,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 || fileneeded[i].status == FS_MD5SUMBAD) if (fileneeded[i].status == FS_NOTFOUND)
{ {
if (!curl_running) if (!curl_running)
CURLPrepareFile(http_source, i); CURLPrepareFile(http_source, i);
@ -3901,9 +3935,7 @@ static void HandleConnect(SINT8 node)
if (netbuffer->u.clientcfg.needsdownload) if (netbuffer->u.clientcfg.needsdownload)
{ {
netbuffer->packettype = PT_DOWNLOADFILESOKAY; netbuffer->packettype = PT_DOWNLOADFILESOKAY;
strncpy(netbuffer->u.filecfg.http_source, cv_httpsource.string, HSendPacket(node, true, 0, 0);
MAX_MIRROR_LENGTH);
HSendPacket(node, true, 0, sizeof netbuffer->u.filecfg);
return; return;
} }
@ -4186,17 +4218,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
SERVERONLY SERVERONLY
#ifdef HAVE_CURL // This should've already been checked, but just to be safe...
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();
@ -4218,7 +4240,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_mode == CL_WAITDOWNLOADFILESRESPONSE && CL_SendRequestFile()) if (CL_SendRequestFile())
cl_mode = CL_DOWNLOADFILES; cl_mode = CL_DOWNLOADFILES;
break; break;

View File

@ -462,11 +462,6 @@ 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
// //
@ -501,7 +496,6 @@ 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;