Skip to content

Commit

Permalink
Resolve conflicting port options between chat, master, and world
Browse files Browse the repository at this point in the history
move chat_server_port to shared since it's used by world and chat
  • Loading branch information
aronwk-aaron committed Jan 3, 2024
1 parent dc45436 commit 9920f01
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ foreach(resource_file ${RESOURCE_FILES})
)
message(STATUS "Moved " ${resource_file} " to project binary directory")
elseif(resource_file MATCHES ".ini")
UpdateConfigOption("build/authconfig.ini" "port" "auth_server_port")
UpdateConfigOption("build/chatconfig.ini" "port" "chat_server_port")
UpdateConfigOption("build/masterconfig.ini" "port" "master_server_port")
message(STATUS "Checking " ${resource_file} " for missing config options")
file(READ ${PROJECT_BINARY_DIR}/${resource_file} current_file_contents)
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
Expand Down
2 changes: 1 addition & 1 deletion dAuthServer/AuthServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int main(int argc, char** argv) {
uint32_t maxClients = 50;
uint32_t ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
if (Game::config->GetValue("auth_server_port") != "") ourPort = std::atoi(Game::config->GetValue("auth_server_port").c_str());

Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Auth, Game::config, &Game::lastSignal);

Expand Down
2 changes: 1 addition & 1 deletion dChatServer/ChatServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int main(int argc, char** argv) {
uint32_t maxClients = 50;
uint32_t ourPort = 1501;
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
if (Game::config->GetValue("chat_server_port") != "") ourPort = std::atoi(Game::config->GetValue("chat_server_port").c_str());

Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Chat, Game::config, &Game::lastSignal);

Expand Down
2 changes: 1 addition & 1 deletion dMasterServer/MasterServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ int main(int argc, char** argv) {
uint32_t maxClients = 999;
uint32_t ourPort = 1000;
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
if (Game::config->GetValue("port") != "") ourPort = std::stoi(Game::config->GetValue("port"));
if (Game::config->GetValue("master_server_port") != "") ourPort = std::stoi(Game::config->GetValue("master_server_port"));

Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, true, false, Game::logger, "", 0, ServerType::Master, Game::config, &Game::lastSignal);

Expand Down
2 changes: 1 addition & 1 deletion resources/authconfig.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Port number. The client has the authserver port hardcoded to 1001
port=1001
auth_server_port=1001

# 0 or 1, should ignore playkeys
# If 1 everyone with an account will be able to login, regardless of if they have a key or not
Expand Down
3 changes: 0 additions & 3 deletions resources/chatconfig.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Port number
port=2005

# If you would like to increase the maximum number of best friends a player can have on the server
# Change the value below to what you would like this to be (5 is live accurate)
max_number_of_best_friends=5
Expand Down
2 changes: 1 addition & 1 deletion resources/masterconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
master_ip=localhost

# Port number
port=2000
master_server_port=2000

# The port number to start world servers on. Will be incremented for each world
world_port_start=3000
Expand Down
4 changes: 4 additions & 0 deletions resources/sharedconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ event_8=
version_major=1
version_current=10
version_minor=64

# The port the chat server is started and listening on
# Used in chat and world servers
chat_server_port=2005
3 changes: 0 additions & 3 deletions resources/worldconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# If you fork this repository and/or make changes to the code, reflect that here to comply with AGPLv3
source=https://github.com/DarkflameUniverse/DarkflameServer

# Port to the chat server, same as in chatconfig.ini
chat_server_port=2005

# 0 or 1, should disable chat
disable_chat=0

Expand Down

0 comments on commit 9920f01

Please sign in to comment.