From 8b047efca479cea213f8b685a8185ff01a41dabb Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 20 Jul 2023 20:35:01 +0300 Subject: [PATCH 1/3] Make connection timeout configurable via cvar (in minutes, 0 for no time out) --- src/d_clisrv.c | 19 +++++++++++-------- src/d_clisrv.h | 2 ++ src/d_netcmd.c | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 213c0eea1..e668e07d3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2509,18 +2509,19 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic } break; case CL_ASKJOIN: - if (firstconnectattempttime + NEWTICRATE*300 < I_GetTime() && !server) + if (cv_connectawaittime.value && firstconnectattempttime + NEWTICRATE*60*cv_connectawaittime.value < I_GetTime() && !server) { - CONS_Printf(M_GetText("5 minute wait time exceeded.\n")); + CONS_Printf("%d minute wait time exceeded.\n", cv_connectawaittime.value); CONS_Printf(M_GetText("Network game synchronization aborted.\n")); D_QuitNetGame(); CL_Reset(); D_StartTitle(); - M_StartMessage(M_GetText( - "5 minute wait time exceeded.\n" + M_StartMessage(va( + "%d minute wait time exceeded.\n" "You may retry connection.\n" "\n" - "Press ESC\n" + "Press ESC\n", + cv_connectawaittime.value ), NULL, MM_NOTHING); return false; } @@ -3883,6 +3884,8 @@ consvar_t cv_noticedownload = {"noticedownload", "Off", CV_SAVE, CV_OnOff, NULL, static CV_PossibleValue_t downloadspeed_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; consvar_t cv_downloadspeed = {"downloadspeed", "MAX", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; + static void Got_AddPlayer(UINT8 **p, INT32 playernum); static void Got_RemovePlayer(UINT8 **p, INT32 playernum); @@ -5979,9 +5982,9 @@ boolean TryRunTics(tic_t realtics) while (neededtic > gametic) { boolean update_stats = !(paused || P_AutoPause()); - + DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic)); - + if (update_stats) PS_START_TIMING(ps_tictime); @@ -5989,7 +5992,7 @@ boolean TryRunTics(tic_t realtics) ExtraDataTicker(); gametic++; consistancy[gametic%TICQUEUE] = Consistancy(); - + if (update_stats) { PS_STOP_TIMING(ps_tictime); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index e2345e673..65fd3c9a9 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -567,6 +567,8 @@ extern consvar_t #endif cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed; +extern consvar_t cv_connectawaittime; + extern consvar_t cv_discordinvites; // Used in d_net, the only dependence diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f8071de8b..45055276e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -739,6 +739,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_maxsend); CV_RegisterVar(&cv_noticedownload); CV_RegisterVar(&cv_downloadspeed); + CV_RegisterVar(&cv_connectawaittime); CV_RegisterVar(&cv_httpsource); #ifndef NONET CV_RegisterVar(&cv_allownewplayer); -- 2.54.0 From a2f2112967f99b75f74e9e615d4062c16b681023 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 22 Jul 2023 00:31:46 +0200 Subject: [PATCH 2/3] Add Connection Option menu Menu for Changing queue time and downloadspeed --- src/m_menu.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 282d203a4..82f87be65 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -325,7 +325,6 @@ menu_t OP_ProtocolDef; menu_t OP_DiscordOptionsDef; #endif menu_t OP_HUDOptionsDef, OP_ChatOptionsDef; -menu_t OP_HudOffsetDef; menu_t OP_GameOptionsDef, OP_ServerOptionsDef; #ifndef NONET menu_t OP_AdvServerOptionsDef; @@ -341,6 +340,10 @@ static patch_t *addonsp[NUM_EXT+5]; static void M_DeleteProtocol(void); +// Saturn +menu_t OP_ConnectDef; +menu_t OP_HudOffsetDef; + // Bird menu_t OP_BirdDef; menu_t OP_TiltDef; @@ -1111,13 +1114,15 @@ static menuitem_t OP_MainMenu[] = {IT_SUBMENU|IT_STRING, NULL, "HUD Options...", &OP_HUDOptionsDef, 60}, {IT_SUBMENU|IT_STRING, NULL, "Gameplay Options...", &OP_GameOptionsDef, 70}, {IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, + + {IT_SUBMENU|IT_STRING, NULL, "Connection Options...", &OP_ConnectDef, 90}, - {IT_SUBMENU|IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 100}, + {IT_SUBMENU|IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 110}, - {IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 120}, - {IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 130}, - - {IT_SUBMENU|IT_STRING, NULL, "Bird", &OP_BirdDef, 150}, + {IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 130}, + {IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 140}, + + {IT_SUBMENU|IT_STRING, NULL, "Bird", &OP_BirdDef, 160}, }; static menuitem_t OP_ControlsMenu[] = @@ -1717,6 +1722,13 @@ static menuitem_t OP_BirdMenu[] = {IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120}, }; +static menuitem_t OP_ConnectMenu[] = +{ + {IT_HEADER, NULL, "Connection Options", NULL, 20}, + {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 40}, + {IT_STRING | IT_CVAR, NULL, "Addon Download Speed", &cv_downloadspeed, 60}, +}; + static menuitem_t OP_TiltMenu[] = { {IT_STRING | IT_CVAR, NULL, "Camera Tilting", &cv_tilting, 0}, @@ -2269,6 +2281,8 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOp menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_HUDOptionsDef, 30, 30); +menu_t OP_ConnectDef = DEFAULTMENUSTYLE(NULL, OP_ConnectMenu, &OP_MainDef, 30, 30); + menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30); menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60); menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60); -- 2.54.0 From cd7c69b4e54036e8165f6a78b2ba1c4e0f17d2b7 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 22 Jul 2023 23:04:54 +0300 Subject: [PATCH 3/3] Add 'Infinite' as possible value for connectawaittime cvar so it is more clear that 0 means 'no timeout' --- src/d_clisrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e668e07d3..adceff581 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3884,7 +3884,8 @@ consvar_t cv_noticedownload = {"noticedownload", "Off", CV_SAVE, CV_OnOff, NULL, static CV_PossibleValue_t downloadspeed_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; consvar_t cv_downloadspeed = {"downloadspeed", "MAX", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}}; +consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static void Got_AddPlayer(UINT8 **p, INT32 playernum); static void Got_RemovePlayer(UINT8 **p, INT32 playernum); -- 2.54.0