1
This commit is contained in:
parent
504964ce43
commit
dbe993d0ee
@ -16,7 +16,7 @@
|
|||||||
#include "GCListener.h"
|
#include "GCListener.h"
|
||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
#include "handlermgr.h"
|
#include "handlermgr.h"
|
||||||
#include "client.h"
|
#include "downstream.h"
|
||||||
#include "gameclientmgr.h"
|
#include "gameclientmgr.h"
|
||||||
#include "ss_msgid.pb.h"
|
#include "ss_msgid.pb.h"
|
||||||
#include "ss_proto.pb.h"
|
#include "ss_proto.pb.h"
|
||||||
@ -347,7 +347,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect) {
|
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect) {
|
||||||
Client* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
|
DownStream* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
|
||||||
if (!client) {
|
if (!client) {
|
||||||
switch (hdr.msgid) {
|
switch (hdr.msgid) {
|
||||||
case ss::_SS_CMLogin:
|
case ss::_SS_CMLogin:
|
||||||
@ -388,7 +388,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
|
DownStream* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
|
||||||
if (client && client->conn) {
|
if (client && client->conn) {
|
||||||
if (client->conn) {
|
if (client->conn) {
|
||||||
client->conn->ForwardClientMsg(hdr);
|
client->conn->ForwardClientMsg(hdr);
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
#include "client.h"
|
#include "downstream.h"
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class TargetConn;
|
class TargetConn;
|
||||||
class Client
|
class DownStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int socket_handle = a8::INVALID_SOCKET_HANDLE;
|
int socket_handle = a8::INVALID_SOCKET_HANDLE;
|
@ -5,7 +5,7 @@
|
|||||||
#include "gameclientmgr.h"
|
#include "gameclientmgr.h"
|
||||||
#include "ss_proto.pb.h"
|
#include "ss_proto.pb.h"
|
||||||
|
|
||||||
#include "client.h"
|
#include "downstream.h"
|
||||||
#include "target_conn.h"
|
#include "target_conn.h"
|
||||||
#include "target_conn_mgr.h"
|
#include "target_conn_mgr.h"
|
||||||
#include "GCListener.h"
|
#include "GCListener.h"
|
||||||
@ -67,7 +67,7 @@ void GameClientMgr::OnTargetServerConnect(a8::XParams& param)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Client* GameClientMgr::GetGameClientBySocket(int sockhandle)
|
DownStream* GameClientMgr::GetGameClientBySocket(int sockhandle)
|
||||||
{
|
{
|
||||||
auto itr = socket_hash_.find(sockhandle);
|
auto itr = socket_hash_.find(sockhandle);
|
||||||
return itr != socket_hash_.end() ? itr->second : nullptr;
|
return itr != socket_hash_.end() ? itr->second : nullptr;
|
||||||
@ -77,11 +77,11 @@ void GameClientMgr::BindTargetConn(int socket_handle, int conn_instance_id)
|
|||||||
{
|
{
|
||||||
TargetConn* conn = TargetConnMgr::Instance()->GetConnById(conn_instance_id);
|
TargetConn* conn = TargetConnMgr::Instance()->GetConnById(conn_instance_id);
|
||||||
if (conn) {
|
if (conn) {
|
||||||
Client* client = GetGameClientBySocket(socket_handle);
|
DownStream* client = GetGameClientBySocket(socket_handle);
|
||||||
if (client) {
|
if (client) {
|
||||||
client->conn = conn;
|
client->conn = conn;
|
||||||
} else {
|
} else {
|
||||||
client = new Client();
|
client = new DownStream();
|
||||||
client->socket_handle = socket_handle;
|
client->socket_handle = socket_handle;
|
||||||
client->conn = conn;
|
client->conn = conn;
|
||||||
socket_hash_[client->socket_handle] = client;
|
socket_hash_[client->socket_handle] = client;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <f8/timer.h>
|
#include <f8/timer.h>
|
||||||
|
|
||||||
class Client;
|
class DownStream;
|
||||||
class GameClientMgr : public a8::Singleton<GameClientMgr>
|
class GameClientMgr : public a8::Singleton<GameClientMgr>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -19,7 +19,7 @@ class GameClientMgr : public a8::Singleton<GameClientMgr>
|
|||||||
void OnTargetServerDisconnect(a8::XParams& param);
|
void OnTargetServerDisconnect(a8::XParams& param);
|
||||||
void OnTargetServerConnect(a8::XParams& param);
|
void OnTargetServerConnect(a8::XParams& param);
|
||||||
#endif
|
#endif
|
||||||
Client* GetGameClientBySocket(int sockhande);
|
DownStream* GetGameClientBySocket(int sockhande);
|
||||||
void BindTargetConn(int socket_handle, int conn_instance_id);
|
void BindTargetConn(int socket_handle, int conn_instance_id);
|
||||||
void AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick);
|
void AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick);
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
a8::Attacher timer_attacher_;
|
a8::Attacher timer_attacher_;
|
||||||
std::map<int, Client*> socket_hash_;
|
std::map<int, DownStream*> socket_hash_;
|
||||||
#if 0
|
#if 0
|
||||||
std::map<int, std::tuple<std::string, long long, timer_list*>> pending_account_hash_;
|
std::map<int, std::tuple<std::string, long long, timer_list*>> pending_account_hash_;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user