This commit is contained in:
aozhiwei 2023-04-23 17:33:15 +08:00
parent 71e7af4212
commit ed0290f709
4 changed files with 29 additions and 4 deletions

View File

@ -23,10 +23,12 @@ message SS_CMKcpHandshake
message SS_SMKcpHandshake message SS_SMKcpHandshake
{ {
optional int32 conv = 1; //conv optional int32 errcode = 1; //errcode != 0kcp
optional bytes secret_key = 2; //secret eky optional string errmsg = 2; //errmsg
optional string remote_host = 3; //host optional int32 conv = 3; //conv
optional int32 remote_port = 4; //port optional bytes secret_key = 4; //secret key客户端每次上报的时候加在包头之前
optional string remote_host = 5; //host
optional int32 remote_port = 6; //port
} }
message SS_CMLogin message SS_CMLogin

View File

@ -409,6 +409,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
ss::SS_CMKcpHandshake msg; ss::SS_CMKcpHandshake msg;
bool ok = msg.ParseFromArray(hdr.buf + hdr.offset, hdr.buflen - hdr.offset); bool ok = msg.ParseFromArray(hdr.buf + hdr.offset, hdr.buflen - hdr.offset);
if (ok) { if (ok) {
LongSessionMgr::Instance()->_SS_CMKcpHandshake(hdr, msg);
} }
} }
break; break;

View File

@ -2,6 +2,7 @@
#include <a8/udplistener.h> #include <a8/udplistener.h>
#include <f8/netmsghandler.h>
#include <f8/udplog.h> #include <f8/udplog.h>
#include "longsessionmgr.h" #include "longsessionmgr.h"
@ -10,6 +11,9 @@
#include "longsession.h" #include "longsession.h"
#include "kcpsession.h" #include "kcpsession.h"
#include "ss_msgid.pb.h"
#include "ss_proto.pb.h"
static void GSUdpListeneron_error(int errorid) static void GSUdpListeneron_error(int errorid)
{ {
f8::UdpLog::Instance()->Debug("GCUdpListeneron_error %d", {errorid}); f8::UdpLog::Instance()->Debug("GCUdpListeneron_error %d", {errorid});
@ -44,6 +48,18 @@ void LongSessionMgr::Update()
} }
} }
void LongSessionMgr::_SS_CMKcpHandshake(f8::MsgHdr& hdr, const ss::SS_CMKcpHandshake& msg)
{
ss::SS_SMKcpHandshake respmsg;
respmsg.set_errcode(0);
if (GetSession(hdr.socket_handle)) {
#ifdef DEBUG
abort();
#endif
return;
}
}
std::shared_ptr<LongSession> LongSessionMgr::GetSession(int socket_handle) std::shared_ptr<LongSession> LongSessionMgr::GetSession(int socket_handle)
{ {
auto itr = socket_handle_hash_.find(socket_handle); auto itr = socket_handle_hash_.find(socket_handle);

View File

@ -8,6 +8,11 @@ namespace a8
struct UdpPacket; struct UdpPacket;
} }
namespace ss
{
class SS_CMKcpHandshake;
}
class LongSession; class LongSession;
class LongSessionMgr : public a8::Singleton<LongSessionMgr> class LongSessionMgr : public a8::Singleton<LongSessionMgr>
{ {
@ -21,6 +26,7 @@ class LongSessionMgr : public a8::Singleton<LongSessionMgr>
void UnInit(); void UnInit();
void Update(); void Update();
void _SS_CMKcpHandshake(f8::MsgHdr& hdr, const ss::SS_CMKcpHandshake& msg);
void ProcUdpPacket(a8::UdpPacket* pkt); void ProcUdpPacket(a8::UdpPacket* pkt);
std::shared_ptr<LongSession> GetSession(int socket_handle); std::shared_ptr<LongSession> GetSession(int socket_handle);