1
This commit is contained in:
parent
9b0eb93c5e
commit
fe3b364116
@ -50,6 +50,12 @@ class WSListener : public a8::Singleton<WSListener>
|
||||
#endif
|
||||
}
|
||||
|
||||
void SendRawDataToClient(int sockhandle, int msgid, const std::string& data)
|
||||
{
|
||||
f8::Net_SendProxyMsg(tcp_listener_, sockhandle, 0, 0, msgid, data);
|
||||
++PerfMonitor::Instance()->send_ws_count;
|
||||
}
|
||||
|
||||
void SendText(unsigned short sockhandle, const std::string& text);
|
||||
void ForceCloseClient(unsigned short sockhandle);
|
||||
void MarkClient(unsigned short sockhandle, bool is_active);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "guild.h"
|
||||
#include "guildmgr.h"
|
||||
#include "cs_msgid.pb.h"
|
||||
#include "ss_msgid.pb.h"
|
||||
#include "cs_proto.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
#include "IMListener.h"
|
||||
@ -96,6 +97,15 @@ void GuildMgr::_SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_Forward
|
||||
CreateAsyncTask(hdr.socket_handle, msg.guild_id(), task);
|
||||
}
|
||||
|
||||
void GuildMgr::_SS_IM_ForwardGuildSMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildSMMsg& msg)
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId
|
||||
(msg.context().user_info().base_data().account_id());
|
||||
if (hum) {
|
||||
WSListener::Instance()->SendRawDataToClient(hum->socket_handle, msg.msgid(), msg.payload());
|
||||
}
|
||||
}
|
||||
|
||||
void GuildMgr::CreateAsyncTask(int socket_handle, long long guild_id, AsyncGuildTask* task)
|
||||
{
|
||||
Guild* guild = GetGuild(guild_id);
|
||||
@ -225,5 +235,27 @@ void GuildMgr::ForwardGuildSMMsg(int socket_handle,
|
||||
*msg.mutable_context() = context;
|
||||
msg.set_msgid(msgid);
|
||||
smmsg.SerializeToString(msg.mutable_payload());
|
||||
IMListener::Instance()->SendMsg(socket_handle, msg);
|
||||
if (socket_handle == 0) {
|
||||
int packlen = msg.ByteSize();
|
||||
char* buff = nullptr;
|
||||
if (packlen > 0) {
|
||||
buff = (char*)malloc(packlen);
|
||||
msg.SerializeToArray(buff, packlen);
|
||||
}
|
||||
App::Instance()->AddSocketMsg
|
||||
(
|
||||
SF_IMServer,
|
||||
0,
|
||||
0,
|
||||
ss::SSMessageId_e::_SS_IM_ForwardGuildSMMsg,
|
||||
0,
|
||||
buff,
|
||||
packlen
|
||||
);
|
||||
if (buff) {
|
||||
free(buff);
|
||||
}
|
||||
} else {
|
||||
IMListener::Instance()->SendMsg(socket_handle, msg);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace ss
|
||||
{
|
||||
class MFIMMsgConext;
|
||||
class SS_IM_ForwardGuildCMMsg;
|
||||
class SS_IM_ForwardGuildSMMsg;
|
||||
}
|
||||
|
||||
class Guild;
|
||||
@ -33,6 +34,7 @@ class GuildMgr : public a8::Singleton<GuildMgr>
|
||||
int msgid,
|
||||
const ::google::protobuf::Message& smmsg);
|
||||
void _SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildCMMsg& msg);
|
||||
void _SS_IM_ForwardGuildSMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildSMMsg& msg);
|
||||
|
||||
private:
|
||||
void CreateAsyncTask(int socket_handle, long long guild_id, AsyncGuildTask* task);
|
||||
|
@ -97,6 +97,7 @@ void HandlerMgr::RegisterNetMsgHandlers()
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupRename);
|
||||
|
||||
RegisterNetMsgHandler(&immsghandler, &GuildMgr::_SS_IM_ForwardGuildCMMsg);
|
||||
RegisterNetMsgHandler(&immsghandler, &GuildMgr::_SS_IM_ForwardGuildSMMsg);
|
||||
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGuildInfo);
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGuildCreate);
|
||||
|
@ -1094,6 +1094,7 @@ void Player::FillIMMsgConext(ss::MFIMMsgConext* context)
|
||||
{
|
||||
FillMFUserInfo(context->mutable_user_info());
|
||||
context->set_seqid(App::Instance()->NewSeqId());
|
||||
context->set_socket_handle(socket_handle);
|
||||
}
|
||||
|
||||
void Player::ForwardGroupCMMsg(f8::MsgHdr& hdr, long long hash_code)
|
||||
|
@ -194,7 +194,7 @@ void SyncHelper::SendIMConnMsg(int instance_id, int msgid, const ::google::proto
|
||||
}
|
||||
App::Instance()->AddSocketMsg
|
||||
(
|
||||
SF_IMServer,
|
||||
SF_IMConn,
|
||||
0,
|
||||
0,
|
||||
msgid,
|
||||
|
@ -6,6 +6,7 @@ message MFIMMsgConext
|
||||
{
|
||||
optional int64 seqid = 1;
|
||||
optional cs.MFUserInfo user_info = 2;
|
||||
optional int32 socket_handle = 3;
|
||||
}
|
||||
|
||||
message MFIMServerInfo
|
||||
|
2
third_party/framework
vendored
2
third_party/framework
vendored
@ -1 +1 @@
|
||||
Subproject commit a1c591dd5f2bad2aba07134fa6b9c2415abff318
|
||||
Subproject commit 579efb2289bc7391e68875fc58ada395ca1a6e2a
|
Loading…
x
Reference in New Issue
Block a user