This commit is contained in:
azw 2023-04-09 08:25:56 +00:00
parent 8857b5ab99
commit a3bf6bd99d
3 changed files with 26 additions and 14 deletions

View File

@ -6,6 +6,7 @@
#include <f8/netmsghandler.h>
#include <f8/udplog.h>
#include <f8/msgqueue.h>
#include "app.h"
#include "GCListener.h"
@ -91,12 +92,16 @@ public:
virtual void OnDisConnect() override
{
#if 0
App::Instance()->AddIMMsg(IM_ClientSocketDisconnect,
a8::XParams()
.SetSender(socket_handle)
.SetParam1(1));
#endif
f8::MsgQueue::Instance()->PostMsg
(
IM_ClientSocketDisconnect,
a8::Args
(
{
(int)socket_handle
}
)
);
}
};

View File

@ -1,6 +1,7 @@
#include "precompile.h"
#include <f8/udplog.h>
#include <f8/msgqueue.h>
#include "downstreammgr.h"
#include "ss_proto.pb.h"
@ -13,6 +14,14 @@
void DownStreamMgr::Init()
{
f8::MsgQueue::Instance()->RegisterCallBack
(
IM_ClientSocketDisconnect,
[this] (const a8::Args& args)
{
int socket_handle = args.Get<int>(0);
OnClientDisconnect(socket_handle);
});
}
void DownStreamMgr::UnInit()
@ -26,21 +35,19 @@ void DownStreamMgr::UnInit()
#endif
}
#if 0
void DownStreamMgr::OnClientDisconnect(a8::XParams& param)
void DownStreamMgr::OnClientDisconnect(int socket_handle)
{
GameClient* client = GetGameClientBySocket(param.sender);
DownStream* client = GetGameClientBySocket(socket_handle);
if (client) {
if (client->conn) {
ss::SS_WSP_SocketDisconnect msg;
client->conn->SendMsg(param.sender, msg);
client->conn->SendMsg(socket_handle, msg);
}
socket_hash_.erase(param.sender);
socket_hash_.erase(socket_handle);
delete client;
}
RemovePendingAccount(param.sender);
RemovePendingAccount(socket_handle);
}
#endif
#if 0
void DownStreamMgr::OnTargetServerDisconnect(a8::XParams& param)

View File

@ -15,7 +15,6 @@ class DownStreamMgr : public a8::Singleton<DownStreamMgr>
void UnInit();
#if 0
void OnClientDisconnect(a8::XParams& param);
void OnTargetServerDisconnect(a8::XParams& param);
void OnTargetServerConnect(a8::XParams& param);
#endif
@ -25,6 +24,7 @@ class DownStreamMgr : public a8::Singleton<DownStreamMgr>
private:
void OnClientDisconnect(int socket_handle);
void RemovePendingAccount(int socket_handle);
private: