Skip to content

Commit

Permalink
Update: Node base module interface is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
i0gan committed Mar 30, 2024
1 parent 10719f0 commit 52cddcd
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 190 deletions.
23 changes: 7 additions & 16 deletions resource/script/multi_start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,10 @@ rem Description: Start all servers script

cd bin

start cmd /c " squick type=master id=1 "
start cmd /c " squick type=login id=2 "
start cmd /c " squick type=world id=100 "
start cmd /c " squick type=world id=101 "
start cmd /c " squick type=db_proxy id=300 "
start cmd /c " squick type=db_proxy id=301 "

start cmd /c " squick type=lobby id=1000 "
start cmd /c " squick type=lobby id=1001 "
start cmd /c " squick type=lobby id=1002 "

rem start cmd /c " squick type=game_mgr id=2000 "

start cmd /c " squick type=proxy id=500 "
start cmd /c " squick type=proxy id=501 "
start cmd /c " squick type=proxy id=502 "
start cmd /c " squick type=master id=1 area=0 ip=127.0.0.1 port=10001 web_port=8888"
start cmd /c " squick type=world id=100 area=0 ip=127.0.0.1 port=10101 master_ip=127.0.0.1 master_port=10001"
start cmd /c " squick type=db_proxy id=300 area=0 ip=127.0.0.1 port=10201 master_ip=127.0.0.1 master_port=10001"
start cmd /c " squick type=login id=2 area=0 ip=127.0.0.1 port=10301 web_port=80 master_ip=127.0.0.1 master_port=10001"
start cmd /c " squick type=lobby id=1000 area=0 ip=127.0.0.1 port=10401 master_ip=127.0.0.1 master_port=10001"
start cmd /c " squick type=lobby id=1001 area=0 ip=127.0.0.1 port=10402 master_ip=127.0.0.1 master_port=10001"
start cmd /c " squick type=proxy id=500 area=0 ip=127.0.0.1 port=10501 master_ip=127.0.0.1 master_port=10001"
25 changes: 6 additions & 19 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,15 @@ void PrintLogo() {
void DefaultStartUp(std::string strArgvList, std::vector<std::shared_ptr<PluginServer>> &serverList) {
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=master id=1 area=0 ip=127.0.0.1 port=10001 web_port=8888")));

serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=world id=100 area=0 ip=127.0.0.1 port=10101 master=127.0.0.1:10001")));
//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=world id=101"))); // 区服2
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=db_proxy id=300 area=0 ip=127.0.0.1 port=10201 master=127.0.0.1:10001")));

//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=db_proxy id=301"))); // 区服2

serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=login id=2 area=0 ip=127.0.0.1 port=10301 web_port=80 master=127.0.0.1:10001")));
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=world id=100 area=0 ip=127.0.0.1 port=10101 master_ip=127.0.0.1 master_port=10001")));
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=db_proxy id=300 area=0 ip=127.0.0.1 port=10201 master_ip=127.0.0.1 master_port=10001")));

serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=login id=2 area=0 ip=127.0.0.1 port=10301 web_port=80 master_ip=127.0.0.1 master_port=10001")));
// Lobby
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=lobby id=1000 area=0 ip=127.0.0.1 port=10401 master=127.0.0.1:10001")));
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=lobby id=1001 area=0 ip=127.0.0.1 port=10402 master=127.0.0.1:10001")));
//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=lobby id=1002")));

// Game
//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=game id=3000")));
//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=game id=3001")));
//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=game_mgr id=2000")));

serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=proxy id=500 area=0 ip=127.0.0.1 port=10501 master=127.0.0.1:10001")));
//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=proxy id=501")));
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=lobby id=1000 area=0 ip=127.0.0.1 port=10401 master_ip=127.0.0.1 master_port=10001")));
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=lobby id=1001 area=0 ip=127.0.0.1 port=10402 master_ip=127.0.0.1 master_port=10001")));
serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=proxy id=500 area=0 ip=127.0.0.1 port=10501 master_ip=127.0.0.1 master_port=10001")));

//serverList.push_back(std::shared_ptr<PluginServer>(new PluginServer(strArgvList + " type=proxy id=502"))); // 区服2
}

void TutorialStartUp(std::string strArgvList, std::vector<std::shared_ptr<PluginServer>>& serverList) {
Expand Down
2 changes: 1 addition & 1 deletion src/node/db_proxy/node/node_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace db_proxy::node {
bool NodeModule::AfterStart() {

Listen();
AddServer(ServerType::ST_WORLD);
ConnectToMaster();
return true;
}

Expand Down
6 changes: 4 additions & 2 deletions src/node/lobby/node/node_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
namespace lobby::node {
bool NodeModule::AfterStart() {
Listen();
AddServer(ServerType::ST_WORLD);
AddServer(ServerType::ST_DB_PROXY);
//AddServer(ServerType::ST_WORLD);
//AddServer(ServerType::ST_DB_PROXY);

ConnectToMaster();
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/node/login/node/node_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bool NodeModule::BeforeDestory() { return true; }
bool NodeModule::AfterStart() {
m_net_->AddReceiveCallBack(this, &NodeModule::InvalidMessage);
Listen();
AddServer(ServerType::ST_MASTER);
ConnectToMaster();
return true;
}

Expand Down
4 changes: 1 addition & 3 deletions src/node/proxy/node/node_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ bool NodeModule::AfterStart() {
m_net_client_->AddReceiveCallBack(ServerType::ST_LOBBY, this, &NodeModule::Transport);
m_net_client_->AddReceiveCallBack(ServerType::ST_LOGIN, rpc::LoginRPC::ACK_PROXY_CONNECT_VERIFY, this, &NodeModule::OnAckProxyConnectVerify);
m_net_client_->AddReceiveCallBack(ServerType::ST_LOBBY, rpc::PlayerEventRPC::PLAYER_BIND_EVENT, this, &NodeModule::PlayerBindEvent);
AddServer(ServerType::ST_LOBBY);
AddServer(ServerType::ST_LOGIN);
AddServer(ServerType::ST_WORLD);
ConnectToMaster();

// ws

Expand Down
3 changes: 1 addition & 2 deletions src/node/world/node/node_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
namespace world::node {
bool NodeModule::AfterStart() {
Listen();

AddServer(ServerType::ST_MASTER);
ConnectToMaster();

return true;
}
Expand Down
Loading

0 comments on commit 52cddcd

Please sign in to comment.