From fcb2888017975f406166b9a86c9576493c9b6c03 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 13 Aug 2019 11:06:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dteam=5Fid=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/wsproxy/mastersvrmgr.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/wsproxy/mastersvrmgr.cc b/server/wsproxy/mastersvrmgr.cc index 2a3fec5..c953bec 100644 --- a/server/wsproxy/mastersvrmgr.cc +++ b/server/wsproxy/mastersvrmgr.cc @@ -72,10 +72,18 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_ return; } unsigned int code = 0; + std::string team_uuid = team_id; if (!team_id.empty()) { code = a8::openssl::Crc32((unsigned char*)team_id.data(), team_id.size()); } else { - std::string data = a8::Format("!%s_%s_%d", {account_id, App::Instance()->uuid.Generate(), getpid()}); + std::string data = a8::Format("!%s_%s_%d_%d", + { + account_id, + App::Instance()->uuid.Generate(), + getpid(), + rand() + }); + team_uuid = data; code = a8::openssl::Crc32((unsigned char*)data.data(), data.size()); } MasterSvr* svr = GetConnById(code % mastersvr_hash_.size() + 1); @@ -87,7 +95,7 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_ ss::SS_WSP_RequestTargetServer msg; msg.set_context_id(curr_context_id_); - msg.set_team_id(team_id); + msg.set_team_id(team_uuid); svr->SendMsg(msg); pending_socket_hash_[hdr.socket_handle] = curr_context_id_;