1
This commit is contained in:
parent
71e7af4212
commit
ed0290f709
@ -23,10 +23,12 @@ message SS_CMKcpHandshake
|
||||
|
||||
message SS_SMKcpHandshake
|
||||
{
|
||||
optional int32 conv = 1; //conv
|
||||
optional bytes secret_key = 2; //secret eky
|
||||
optional string remote_host = 3; //host
|
||||
optional int32 remote_port = 4; //port
|
||||
optional int32 errcode = 1; //errcode != 0时表示不支持kcp
|
||||
optional string errmsg = 2; //errmsg
|
||||
optional int32 conv = 3; //用来作为客户端的conv
|
||||
optional bytes secret_key = 4; //secret key客户端每次上报的时候加在包头之前
|
||||
optional string remote_host = 5; //host
|
||||
optional int32 remote_port = 6; //port
|
||||
}
|
||||
|
||||
message SS_CMLogin
|
||||
|
@ -409,6 +409,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
|
||||
ss::SS_CMKcpHandshake msg;
|
||||
bool ok = msg.ParseFromArray(hdr.buf + hdr.offset, hdr.buflen - hdr.offset);
|
||||
if (ok) {
|
||||
LongSessionMgr::Instance()->_SS_CMKcpHandshake(hdr, msg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <a8/udplistener.h>
|
||||
|
||||
#include <f8/netmsghandler.h>
|
||||
#include <f8/udplog.h>
|
||||
|
||||
#include "longsessionmgr.h"
|
||||
@ -10,6 +11,9 @@
|
||||
#include "longsession.h"
|
||||
#include "kcpsession.h"
|
||||
|
||||
#include "ss_msgid.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
|
||||
static void GSUdpListeneron_error(int 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)
|
||||
{
|
||||
auto itr = socket_handle_hash_.find(socket_handle);
|
||||
|
@ -8,6 +8,11 @@ namespace a8
|
||||
struct UdpPacket;
|
||||
}
|
||||
|
||||
namespace ss
|
||||
{
|
||||
class SS_CMKcpHandshake;
|
||||
}
|
||||
|
||||
class LongSession;
|
||||
class LongSessionMgr : public a8::Singleton<LongSessionMgr>
|
||||
{
|
||||
@ -21,6 +26,7 @@ class LongSessionMgr : public a8::Singleton<LongSessionMgr>
|
||||
void UnInit();
|
||||
void Update();
|
||||
|
||||
void _SS_CMKcpHandshake(f8::MsgHdr& hdr, const ss::SS_CMKcpHandshake& msg);
|
||||
void ProcUdpPacket(a8::UdpPacket* pkt);
|
||||
std::shared_ptr<LongSession> GetSession(int socket_handle);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user