1
This commit is contained in:
parent
3901bc6433
commit
4f6397210a
@ -10,7 +10,10 @@
|
||||
#include <a8/timer.h>
|
||||
#include <a8/ioloop.h>
|
||||
#include <a8/asynctcpclient.h>
|
||||
|
||||
#include "app.h"
|
||||
#include "playermgr.h"
|
||||
#include "jsondatamgr.h"
|
||||
|
||||
const int PACK_MAX = 1024 * 64 * 2;
|
||||
|
||||
@ -41,6 +44,7 @@ void MSConn::Init(int instance_id, const std::string& remote_ip, int remote_port
|
||||
MSConn* conn = (MSConn*)param.sender.GetUserData();
|
||||
conn->CheckAlive();
|
||||
conn->SyncIMServerList();
|
||||
conn->ReportServerInfo();
|
||||
});
|
||||
}
|
||||
|
||||
@ -183,3 +187,16 @@ void MSConn::SyncIMServerList()
|
||||
SendMsg(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void MSConn::ReportServerInfo()
|
||||
{
|
||||
if (Connected()) {
|
||||
ss::SS_IM_ReportServerInfo msg;
|
||||
msg.set_instance_id(App::Instance()->instance_id);
|
||||
msg.set_online_num(PlayerMgr::Instance()->OnlineNum());
|
||||
msg.set_ip(JsonDataMgr::Instance()->GetConf()->At("ip")->AsXValue().GetString());
|
||||
msg.set_port(JsonDataMgr::Instance()->GetConf()->At("wsproxy_port")->AsXValue().GetInt());
|
||||
msg.set_servicing(App::Instance()->servicing);
|
||||
SendMsg(msg);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ class MSConn
|
||||
|
||||
void CheckAlive();
|
||||
void SyncIMServerList();
|
||||
void ReportServerInfo();
|
||||
|
||||
private:
|
||||
char *recv_buff_ = nullptr;
|
||||
|
@ -66,6 +66,7 @@ private:
|
||||
public:
|
||||
int instance_id = 0;
|
||||
int nowtime = 0;
|
||||
bool servicing = true;
|
||||
|
||||
private:
|
||||
std::mutex *loop_mutex_ = nullptr;
|
||||
|
@ -43,9 +43,9 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
|
||||
void OnWSProxyDisconnect(a8::XParams& param);
|
||||
void WatchPlayer(Friend& friend_data);
|
||||
void UnWatchPlayer(Friend& friend_data);
|
||||
int OnlineNum();
|
||||
|
||||
private:
|
||||
int OnlineNum();
|
||||
void OnClientDisconnect(a8::XParams& param);
|
||||
void RemovePlayerBySocket(int socket_handle);
|
||||
f8::MsgHdr* GetHdrBySocket(int socket_handle);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "framework/cpp/netmsghandler.h"
|
||||
|
||||
//game client listener
|
||||
namespace a8
|
||||
{
|
||||
@ -29,6 +31,9 @@ class GGListener : public a8::Singleton<GGListener>
|
||||
{
|
||||
static int msgid = f8::Net_GetMessageId(msg);
|
||||
f8::Net_SendMsg(tcp_listener_, sockhandle, 0, msgid, msg);
|
||||
#ifdef DEBUG
|
||||
f8::DumpMsgToLog(msg, "<<<<<<<WSL ");
|
||||
#endif
|
||||
}
|
||||
|
||||
void SendText(int sockhandle, const std::string& text);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "framework/cpp/netmsghandler.h"
|
||||
|
||||
//imserver listener
|
||||
namespace a8
|
||||
{
|
||||
@ -21,6 +23,9 @@ class IMListener : public a8::Singleton<IMListener>
|
||||
{
|
||||
static int msgid = f8::Net_GetMessageId(msg);
|
||||
f8::Net_SendMsg(tcp_listener_, sockhandle, 0, msgid, msg);
|
||||
#ifdef DEBUG
|
||||
f8::DumpMsgToLog(msg, "<<<<<<<IML ");
|
||||
#endif
|
||||
}
|
||||
|
||||
void SendText(int sockhandle, const std::string& text);
|
||||
|
@ -339,6 +339,9 @@ void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
||||
ProcessNetMsg(handler, SvrMgr::Instance(), hdr);
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
f8::DumpMsgToLog(hdr, handler, ">>>>>>WSP ");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +354,18 @@ void App::ProcessIMServerMsg(f8::MsgHdr& hdr)
|
||||
case HID_IMSMgr:
|
||||
ProcessNetMsg(handler, IMSMgr::Instance(), hdr);
|
||||
break;
|
||||
case HID_SvrMgr:
|
||||
ProcessNetMsg(handler, SvrMgr::Instance(), hdr);
|
||||
break;
|
||||
case HID_CacheMgr:
|
||||
ProcessNetMsg(handler, CacheMgr::Instance(), hdr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
f8::DumpMsgToLog(hdr, handler, ">>>>>>IMS ");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,5 +16,5 @@ namespace google
|
||||
}
|
||||
|
||||
#include "framework/cpp/types.h"
|
||||
#include "framework/cpp/utils.h"
|
||||
#include "framework/cpp/protoutils.h"
|
||||
|
||||
|
2
third_party/framework
vendored
2
third_party/framework
vendored
@ -1 +1 @@
|
||||
Subproject commit 6d4d04235b27818b29d0f83206052de90ac8afd8
|
||||
Subproject commit a24a743b051656e599f0939a49fed3847ed17206
|
Loading…
x
Reference in New Issue
Block a user