mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-07-19 13:18:10 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f738950934 | |||
| fbce8a946e | |||
| 840f9b9f9d | |||
| 9c3042280d |
@@ -84,6 +84,7 @@ void TClient::Disconnect(std::string_view Reason) {
|
|||||||
if (ec) {
|
if (ec) {
|
||||||
beammp_debugf("Failed to shutdown client socket: {}", ec.message());
|
beammp_debugf("Failed to shutdown client socket: {}", ec.message());
|
||||||
}
|
}
|
||||||
|
mSocket.cancel();
|
||||||
mSocket.close(ec);
|
mSocket.close(ec);
|
||||||
if (ec) {
|
if (ec) {
|
||||||
beammp_debugf("Failed to close client socket: {}", ec.message());
|
beammp_debugf("Failed to close client socket: {}", ec.message());
|
||||||
|
|||||||
+4
-2
@@ -62,7 +62,9 @@ static constexpr std::string_view StrPassword = "Password";
|
|||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
static constexpr std::string_view StrHideUpdateMessages = "ImScaredOfUpdates";
|
static constexpr std::string_view StrHideUpdateMessages = "ImScaredOfUpdates";
|
||||||
|
static constexpr std::string_view EnvStrHideUpdateMessages = "BEAMMP_IM_SCARED_OF_UPDATES";
|
||||||
static constexpr std::string_view StrUpdateReminderTime = "UpdateReminderTime";
|
static constexpr std::string_view StrUpdateReminderTime = "UpdateReminderTime";
|
||||||
|
static constexpr std::string_view EnvStrUpdateReminderTime = "BEAMMP_UPDATE_REMINDER_TIME";
|
||||||
|
|
||||||
TEST_CASE("TConfig::TConfig") {
|
TEST_CASE("TConfig::TConfig") {
|
||||||
const std::string CfgFile = "beammp_server_testconfig.toml";
|
const std::string CfgFile = "beammp_server_testconfig.toml";
|
||||||
@@ -263,8 +265,8 @@ void TConfig::ParseFromFile(std::string_view name) {
|
|||||||
TryReadValue(data, "General", StrLogChat, EnvStrLogChat, Settings::Key::General_LogChat);
|
TryReadValue(data, "General", StrLogChat, EnvStrLogChat, Settings::Key::General_LogChat);
|
||||||
TryReadValue(data, "General", StrAllowGuests, EnvStrAllowGuests, Settings::Key::General_AllowGuests);
|
TryReadValue(data, "General", StrAllowGuests, EnvStrAllowGuests, Settings::Key::General_AllowGuests);
|
||||||
// Misc
|
// Misc
|
||||||
TryReadValue(data, "Misc", StrHideUpdateMessages, "", Settings::Key::Misc_ImScaredOfUpdates);
|
TryReadValue(data, "Misc", StrHideUpdateMessages, EnvStrHideUpdateMessages, Settings::Key::Misc_ImScaredOfUpdates);
|
||||||
TryReadValue(data, "Misc", StrUpdateReminderTime, "", Settings::Key::Misc_UpdateReminderTime);
|
TryReadValue(data, "Misc", StrUpdateReminderTime, EnvStrUpdateReminderTime, Settings::Key::Misc_UpdateReminderTime);
|
||||||
|
|
||||||
} catch (const std::exception& err) {
|
} catch (const std::exception& err) {
|
||||||
beammp_error("Error parsing config file value: " + std::string(err.what()));
|
beammp_error("Error parsing config file value: " + std::string(err.what()));
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ static sol::protected_function AddTraceback(sol::state_view StateView, sol::prot
|
|||||||
static std::optional<sol::function> GetLuaHandler(sol::state_view StateView, const std::string Handler, const std::string EventName);
|
static std::optional<sol::function> GetLuaHandler(sol::state_view StateView, const std::string Handler, const std::string EventName);
|
||||||
|
|
||||||
static std::optional<sol::function> GetLuaHandler(sol::state_view StateView, const std::string Handler, const std::string EventName) {
|
static std::optional<sol::function> GetLuaHandler(sol::state_view StateView, const std::string Handler, const std::string EventName) {
|
||||||
|
if (!StateView)
|
||||||
|
return std::nullopt;
|
||||||
auto Res = StateView.safe_script("return " + Handler, sol::script_pass_on_error);
|
auto Res = StateView.safe_script("return " + Handler, sol::script_pass_on_error);
|
||||||
if (!Res.valid()) {
|
if (!Res.valid()) {
|
||||||
beammp_errorf("invalid handler for event \"{}\". handler: \"{}\"", EventName, Handler);
|
beammp_errorf("invalid handler for event \"{}\". handler: \"{}\"", EventName, Handler);
|
||||||
|
|||||||
Reference in New Issue
Block a user