This commit is contained in:
aozhiwei 2019-05-17 16:14:41 +08:00
parent d16e00654d
commit b82a5e2d02
2 changed files with 5 additions and 8 deletions

View File

@ -336,23 +336,20 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
return; return;
} }
#if MASTER_MODE #if MASTER_MODE
TargetConn* conn = nullptr;
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReConnect) { if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReConnect) {
ss::SS_CMLogin_CMReConnect_CommonHead2 msg; ss::SS_CMLogin_CMReConnect_CommonHead2 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) {
MasterSvrMgr::Instance()->RequestTargetServer(hdr, msg.team_uuid()); MasterSvrMgr::Instance()->RequestTargetServer(hdr, msg.team_uuid());
} }
return;
} else { } else {
GameClient* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle); GameClient* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
if (client) { if (client && client->conn) {
conn = client->conn; if (client->conn) {
client->conn->ForwardClientMsg(hdr);
}
} }
} }
if (conn) {
conn->ForwardClientMsg(hdr);
}
#else #else
TargetConn* conn = nullptr; TargetConn* conn = nullptr;
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReConnect) { if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReConnect) {

View File

@ -42,7 +42,7 @@ void MasterSvrMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_
std::string key = msg.host() + ":" + a8::XValue(msg.port()).GetString(); std::string key = msg.host() + ":" + a8::XValue(msg.port()).GetString();
TargetConn* conn = TargetConnMgr::Instance()->GetConnByKey(key); TargetConn* conn = TargetConnMgr::Instance()->GetConnByKey(key);
if (conn) { if (conn) {
conn->ForwardClientMsg(hdr);
} }
} }