修复team_id问题

This commit is contained in:
aozhiwei 2019-08-13 11:06:53 +08:00
parent 6fbbabfd03
commit fcb2888017

View File

@ -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_;