1
This commit is contained in:
parent
62515235ca
commit
f2d751f396
@ -157,7 +157,7 @@ void RoomMgr::RemoveFromInactiveRoomHash(long long room_uuid)
|
||||
inactive_room_hash_.erase(room_uuid);
|
||||
}
|
||||
|
||||
void RoomMgr::ReportServerState(int instanc_id, const std::string& host, int port)
|
||||
void RoomMgr::ReportServerState(int instance_id, const std::string& host, int port)
|
||||
{
|
||||
std::string url = a8::Format("http://%s:%d/webapp/index.php?",
|
||||
{
|
||||
@ -170,14 +170,41 @@ void RoomMgr::ReportServerState(int instanc_id, const std::string& host, int por
|
||||
url_params->SetVal("port", JsonDataMgr::Instance()->listen_port);
|
||||
url_params->SetVal("online_num", PlayerMgr::Instance()->OnlineNum());
|
||||
url_params->SetVal("room_num", ActiveRoomNum());
|
||||
f8::HttpClientPool::Instance()->HttpGet(a8::XParams(),
|
||||
f8::HttpClientPool::Instance()->HttpGet(a8::XParams()
|
||||
.SetSender(instance_id)
|
||||
.SetParam1(host)
|
||||
.SetParam2(port),
|
||||
[] (a8::XParams& param, a8::XObject& data)
|
||||
{
|
||||
|
||||
a8::Timer::Instance()->AddDeadLineTimer(1000,
|
||||
a8::XParams()
|
||||
.SetSender(param.sender)
|
||||
.SetParam1(param.param1)
|
||||
.SetParam2(param.param2),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomMgr::Instance()->ReportServerState(
|
||||
param.sender,
|
||||
param.param1,
|
||||
param.param2
|
||||
);
|
||||
});
|
||||
},
|
||||
[] (a8::XParams& param, const std::string& response)
|
||||
{
|
||||
|
||||
a8::Timer::Instance()->AddDeadLineTimer(1000,
|
||||
a8::XParams()
|
||||
.SetSender(param.sender)
|
||||
.SetParam1(param.param1)
|
||||
.SetParam2(param.param2),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomMgr::Instance()->ReportServerState(
|
||||
param.sender,
|
||||
param.param1,
|
||||
param.param2
|
||||
);
|
||||
});
|
||||
},
|
||||
url.c_str(),
|
||||
*url_params,
|
||||
|
@ -28,7 +28,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
|
||||
private:
|
||||
Room* GetJoinableRoom(const std::string& account_id);
|
||||
void ReportServerState(int instanc_id, const std::string& host, int port);
|
||||
void ReportServerState(int instance_id, const std::string& host, int port);
|
||||
|
||||
private:
|
||||
std::map<long long, Room*> inactive_room_hash_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user