diff --git a/docs/docs.polserver.com/pol100/corechanges.xml b/docs/docs.polserver.com/pol100/corechanges.xml index acaabd49ce..79c078adb1 100644 --- a/docs/docs.polserver.com/pol100/corechanges.xml +++ b/docs/docs.polserver.com/pol100/corechanges.xml @@ -2,9 +2,15 @@
Latest Core Changes - 03-24-2024 + 04-12-2024
+ + 04-12-2024 + Kevin: + For thread-safety, the debug password in pol.cfg may no longer be changed
+when the server is running.
+
03-24-2024 Kevin: diff --git a/pol-core/doc/core-changes.txt b/pol-core/doc/core-changes.txt index 1791aaaefd..30729de599 100644 --- a/pol-core/doc/core-changes.txt +++ b/pol-core/doc/core-changes.txt @@ -1,4 +1,7 @@ -- POL100.2.0 -- +04-12-2024 Kevin: + Changed: For thread-safety, the debug password in pol.cfg may no longer be changed + when the server is running. 03-24-2024 Kevin: Added: `lastrealm` parameter to WalkOnScript. Added: Boat WalkOnScript now triggers in the same manner as other Multis and Items. diff --git a/pol-core/pol/polcfg.cpp b/pol-core/pol/polcfg.cpp index b3ca0edbf4..34cdada2cb 100644 --- a/pol-core/pol/polcfg.cpp +++ b/pol-core/pol/polcfg.cpp @@ -98,6 +98,8 @@ void PolConfig::read_pol_config( bool initial_load ) Plib::systemstate.config.debug_port = elem.remove_ushort( "DebugPort", 0 ); Plib::systemstate.config.dap_debug_port = elem.remove_ushort( "DAPDebugPort", 0 ); + Plib::systemstate.config.debug_password = elem.remove_string( "DebugPassword", "" ); + Plib::systemstate.config.debug_local_only = elem.remove_bool( "DebugLocalOnly", true ); Plib::systemstate.config.account_save = elem.remove_int( "AccountDataSave", -1 ); if ( Plib::systemstate.config.account_save > 0 ) @@ -222,8 +224,6 @@ void PolConfig::read_pol_config( bool initial_load ) elem.remove_bool( "DisplayUnknownPackets", false ); Plib::systemstate.config.exp_los_checks_map = elem.remove_bool( "ExpLosChecksMap", true ); Plib::systemstate.config.enable_debug_log = elem.remove_bool( "EnableDebugLog", false ); - Plib::systemstate.config.debug_password = elem.remove_string( "DebugPassword", "" ); - Plib::systemstate.config.debug_local_only = elem.remove_bool( "DebugLocalOnly", true ); Plib::systemstate.config.log_traces_when_stuck = elem.remove_bool( "ThreadStacktracesWhenStuck", false ); diff --git a/pol-core/pol/polcfg.h b/pol-core/pol/polcfg.h index 208985c0d6..c92bb9fd5f 100644 --- a/pol-core/pol/polcfg.h +++ b/pol-core/pol/polcfg.h @@ -30,7 +30,7 @@ struct PolConfig std::string realm_data_path; std::string pidfile_path; std::atomic verbose; - unsigned short loglevel; // 0=nothing 10=lots + std::atomic loglevel; // 0=nothing 10=lots unsigned short select_timeout_usecs; unsigned short loginserver_timeout_mins; bool watch_rpm; @@ -69,6 +69,7 @@ struct PolConfig bool exp_los_checks_map; bool enable_debug_log; + // Debugger properties must be only when initial_load is true in read_pol_config. unsigned short debug_port; unsigned short dap_debug_port; std::string debug_password; @@ -94,8 +95,8 @@ struct PolConfig bool disable_nagle; bool show_realm_info; bool enforce_mount_objtype; - bool single_thread_decay; - bool thread_decay_statistics; + std::atomic single_thread_decay; + std::atomic thread_decay_statistics; bool show_warning_gump; bool show_warning_item; diff --git a/pol-core/pol/ssopt.h b/pol-core/pol/ssopt.h index dbf5486080..279a5bacd1 100644 --- a/pol-core/pol/ssopt.h +++ b/pol-core/pol/ssopt.h @@ -25,6 +25,7 @@ #ifndef SSOPT_H #define SSOPT_H +#include #include #include @@ -41,9 +42,9 @@ struct ServSpecOpt { bool allow_secure_trading_in_warmode; unsigned int dblclick_wait; - bool decay_items; - unsigned int default_decay_time; - bool refresh_decay_after_boat_moves; + std::atomic decay_items; + std::atomic default_decay_time; + std::atomic refresh_decay_after_boat_moves; unsigned short default_doubleclick_range; unsigned short default_accessible_range; unsigned short default_light_level; diff --git a/testsuite/pol/scripts/tests.src b/testsuite/pol/scripts/tests.src index 47f0c84136..7febbdddcb 100644 --- a/testsuite/pol/scripts/tests.src +++ b/testsuite/pol/scripts/tests.src @@ -6,6 +6,7 @@ use file; include "testutil"; program tests() + ReloadConfiguration(); // A crude attempt to catch issues with thread-safety and pol config & ssopts. var test_count:=CInt(GetEnvironmentVariable("POLCORE_TEST_RUN")); syslog( $"\n{CONSOLE_COLOR_CYAN}##########################\n" @@ -29,7 +30,7 @@ program tests() if (restartpkg) testpkgs.append(restartpkg); endif - + var filter:=GetEnvironmentVariable("POLCORE_TEST_FILTER"); if (filter) syslog("## using testfilter \""+filter+"\"\n",0,CONSOLE_COLOR_CYAN); @@ -39,7 +40,7 @@ program tests() if (filter and !pkg[1].find(filter)) continue; endif - + if (test_count==2 and pkg[1]!="testrestart") continue; endif @@ -76,11 +77,11 @@ program tests() if (script[2] == IGNORE_TEST) continue; endif - + foreach func in (script[1].exported_functions) var startms:=ReadMillisecondClock(); syslog(" Calling {}..".format(func),0,CONSOLE_COLOR_GREEN); - var res:=script[1].call(func); + var res:=script[1].call(func); if (res != 1) syslog(" failed: "+res.errortext,0,CONSOLE_COLOR_RED); exitcode:=1; @@ -98,7 +99,7 @@ program tests() endif syslog("..{}ms".format(ReadMillisecondClock()-pkgstartms),0,CONSOLE_COLOR_MAGENTA); endforeach - + var result:=$"{CONSOLE_COLOR_GREEN}success"; if (exitcode) result:=$"{CONSOLE_COLOR_RED}failed ";