mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 02:38:45 +00:00
Merge fix
This commit is contained in:
@@ -20,9 +20,12 @@
|
||||
#include "common/eqemu_config.h"
|
||||
#include "common/repositories/zone_repository.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <csignal>
|
||||
#include <thread>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
Database db;
|
||||
Database db2;
|
||||
|
||||
@@ -60,8 +63,6 @@ void WorldserverCLI::TestDatabaseConcurrency(int argc, char **argv, argh::parser
|
||||
|
||||
LogInfo("Database test");
|
||||
|
||||
auto mutex = new Mutex;
|
||||
|
||||
auto c = EQEmuConfig::get();
|
||||
LogInfo("Connecting to MySQL");
|
||||
if (!db.Connect(
|
||||
@@ -75,19 +76,19 @@ void WorldserverCLI::TestDatabaseConcurrency(int argc, char **argv, argh::parser
|
||||
return;
|
||||
}
|
||||
|
||||
db.SetMutex(mutex);
|
||||
std::shared_ptr<DBcore::Mutex> sharedMutex = std::make_shared<DBcore::Mutex>();
|
||||
|
||||
db.SetMutex(sharedMutex);
|
||||
|
||||
db2.SetMySQL(db);
|
||||
|
||||
db2.SetMutex(mutex);
|
||||
db2.SetMutex(sharedMutex);
|
||||
|
||||
std::thread(DatabaseTest).detach();
|
||||
std::thread(DatabaseTest).detach();
|
||||
std::thread(DatabaseTestSecondConnection).detach();
|
||||
|
||||
while (!stop) {
|
||||
|
||||
std::this_thread::sleep_for(0s);
|
||||
}
|
||||
|
||||
safe_delete(mutex);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,5 @@ void WorldserverCLI::DatabaseVersion(int argc, char **argv, argh::parser &cmd, s
|
||||
v["bots_database_version"] = RuleB(Bots, Enabled) ? CURRENT_BINARY_BOTS_DATABASE_VERSION : 0;
|
||||
v["custom_database_version"] = CUSTOM_BINARY_DATABASE_VERSION;
|
||||
|
||||
std::stringstream payload;
|
||||
payload << v;
|
||||
|
||||
std::cout << payload.str() << std::endl;
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "world/world_server_cli.h"
|
||||
|
||||
#include "common/events/player_events.h"
|
||||
#include "common/memory/ksm.hpp"
|
||||
#include "common/memory/ksm.h"
|
||||
|
||||
#include "cereal/archives/json.hpp"
|
||||
#include "cereal/types/vector.hpp"
|
||||
|
||||
@@ -39,8 +39,5 @@ void WorldserverCLI::Version(int argc, char **argv, argh::parser &cmd, std::stri
|
||||
j["database_version"] = CURRENT_BINARY_DATABASE_VERSION;
|
||||
j["server_version"] = CURRENT_VERSION;
|
||||
|
||||
std::stringstream payload;
|
||||
payload << j;
|
||||
|
||||
std::cout << payload.str() << std::endl;
|
||||
std::cout << j << std::endl;
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,14 +24,14 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
typedef enum {
|
||||
enum CLE_Status {
|
||||
Never,
|
||||
Offline,
|
||||
Online,
|
||||
CharSelect,
|
||||
Zoning,
|
||||
InZone
|
||||
} CLE_Status;
|
||||
};
|
||||
|
||||
static const char *CLEStatusString[] = {
|
||||
"Never",
|
||||
|
||||
+2
-2
@@ -25,10 +25,10 @@
|
||||
|
||||
class LauncherLink;
|
||||
|
||||
typedef struct {
|
||||
struct LauncherZone{
|
||||
std::string name;
|
||||
uint16 port;
|
||||
} LauncherZone;
|
||||
};
|
||||
|
||||
//a class exported to perl representing a launcher's in-DB config
|
||||
class EQLConfig {
|
||||
|
||||
@@ -69,10 +69,10 @@ protected:
|
||||
|
||||
uint8 m_dynamicCount;
|
||||
|
||||
typedef struct {
|
||||
struct ZoneState{
|
||||
bool up;
|
||||
uint32 starts; //number of times this zone has started
|
||||
uint16 port; //the port this zone wants to use (0=pick one)
|
||||
} ZoneState;
|
||||
};
|
||||
std::map<std::string, ZoneState> m_states;
|
||||
};
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "common/eq_packet_structs.h"
|
||||
#include "common/event/timer.h"
|
||||
#include "common/linked_list.h"
|
||||
#include "common/mutex.h"
|
||||
#include "common/net/servertalk_client_connection.h"
|
||||
#include "common/net/servertalk_legacy_client_connection.h"
|
||||
#include "common/queue.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/eq_packet_structs.h"
|
||||
#include "common/mutex.h"
|
||||
#include "common/queue.h"
|
||||
#include "common/servertalk.h"
|
||||
#include "common/timer.h"
|
||||
|
||||
@@ -319,14 +319,14 @@ void SharedTaskManager::LoadSharedTaskState()
|
||||
// load character data for member names
|
||||
std::vector<CharacterDataRepository::CharacterData> shared_task_character_data;
|
||||
if (!shared_task_members_data.empty()) {
|
||||
std::vector<uint32_t> character_ids;
|
||||
for (const auto &m: shared_task_members_data) {
|
||||
std::vector<int64_t> character_ids;
|
||||
for (const BaseSharedTaskMembersRepository::SharedTaskMembers& m: shared_task_members_data) {
|
||||
character_ids.emplace_back(m.character_id);
|
||||
}
|
||||
|
||||
shared_task_character_data = CharacterDataRepository::GetWhere(
|
||||
*m_database,
|
||||
fmt::format("id IN ({})", Strings::Join(character_ids, ","))
|
||||
fmt::format("id IN ({})", fmt::join(character_ids, ","))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -44,6 +44,6 @@ public:
|
||||
|
||||
private:
|
||||
inline std::string GetIP() const { return (connection && connection->Handle()) ? connection->Handle()->RemoteIP() : 0; }
|
||||
std::shared_ptr<EQ::Net::ServertalkServerConnection> connection;
|
||||
|
||||
std::shared_ptr<EQ::Net::ServertalkServerConnection> connection;
|
||||
};
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include "common/http/httplib.h"
|
||||
#include "common/http/uri.h"
|
||||
#include "common/ip_util.h"
|
||||
#include "common/net/console_server.h"
|
||||
#include "common/net/servertalk_server.h"
|
||||
#include "common/net/dns.h"
|
||||
#include "common/path_manager.h"
|
||||
#include "common/repositories/character_expedition_lockouts_repository.h"
|
||||
#include "common/repositories/character_task_timers_repository.h"
|
||||
@@ -33,7 +32,6 @@
|
||||
#include "common/rulesys.h"
|
||||
#include "common/strings.h"
|
||||
#include "common/zone_store.h"
|
||||
#include "common/zone_store.h"
|
||||
#include "world/adventure_manager.h"
|
||||
#include "world/dynamic_zone_manager.h"
|
||||
#include "world/login_server_list.h"
|
||||
@@ -49,8 +47,6 @@
|
||||
|
||||
extern WorldConfig Config;
|
||||
|
||||
auto mutex = new Mutex;
|
||||
|
||||
void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *func, std::string message)
|
||||
{
|
||||
// we don't want to loop up with chat messages
|
||||
@@ -180,11 +176,13 @@ bool WorldBoot::LoadDatabaseConnections()
|
||||
}
|
||||
else {
|
||||
content_db.SetMySQL(database);
|
||||
|
||||
// when database and content_db share the same underlying mysql connection
|
||||
// it needs to be protected by a shared mutex otherwise we produce concurrency issues
|
||||
// when database actions are occurring in different threads
|
||||
database.SetMutex(mutex);
|
||||
content_db.SetMutex(mutex);
|
||||
std::shared_ptr<DBcore::Mutex> sharedMutex = std::make_shared<DBcore::Mutex>();
|
||||
database.SetMutex(sharedMutex);
|
||||
content_db.SetMutex(sharedMutex);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -456,7 +454,7 @@ void WorldBoot::CheckForPossibleConfigurationIssues()
|
||||
|
||||
std::string config_address = c->WorldAddress;
|
||||
if (!IpUtil::IsIPAddress(config_address)) {
|
||||
config_address = IpUtil::DNSLookupSync(c->WorldAddress, 9000);
|
||||
config_address = EQ::Net::DNSLookupSync(c->WorldAddress, 9000);
|
||||
LogInfo(
|
||||
"World config address using DNS [{}] resolves to [{}]",
|
||||
c->WorldAddress,
|
||||
@@ -634,7 +632,6 @@ void WorldBoot::CheckForPossibleConfigurationIssues()
|
||||
|
||||
void WorldBoot::Shutdown()
|
||||
{
|
||||
safe_delete(mutex);
|
||||
}
|
||||
|
||||
void WorldBoot::SendDiscordMessage(int webhook_id, const std::string &message)
|
||||
|
||||
Reference in New Issue
Block a user