1
This commit is contained in:
parent
45c356bbfa
commit
40a8f37ed6
@ -232,12 +232,9 @@ void GCListener::SetKey(int sockhandle, const std::string& key)
|
||||
tcp_listener_->UnLockClients();
|
||||
}
|
||||
|
||||
void GCListener::InternalSendMsg(int socket_handle, int msgid, google::protobuf::Message& msg, int guess_size)
|
||||
void GCListener::InternalSendMsg(int socket_handle, int msgid, google::protobuf::Message& msg)
|
||||
{
|
||||
unsigned short packlen = 2 + CustomPbSerializeSize(&msg);
|
||||
if (guess_size > 0 && packlen - 2 < guess_size) {
|
||||
packlen = guess_size + 2;
|
||||
}
|
||||
char* buff = (char*)malloc(sizeof(ServerPktHeader) + packlen);
|
||||
memset(buff, 0, sizeof(ServerPktHeader) + packlen);
|
||||
ServerPktHeader* head = (ServerPktHeader*)buff;
|
||||
|
@ -33,11 +33,11 @@ class GCListener : public a8::Singleton<GCListener>
|
||||
void UnInit();
|
||||
|
||||
template <typename T>
|
||||
void SendMsg(int socket_handle, T& msg, int guess_size = 0)
|
||||
void SendMsg(int socket_handle, T& msg)
|
||||
{
|
||||
static int msgid = f8::Net_GetMessageId(msg);
|
||||
|
||||
InternalSendMsg(socket_handle, msgid, msg, guess_size);
|
||||
InternalSendMsg(socket_handle, msgid, msg);
|
||||
}
|
||||
|
||||
void SendText(int sockhandle, const std::string& text);
|
||||
@ -47,7 +47,7 @@ class GCListener : public a8::Singleton<GCListener>
|
||||
void SetKey(int sockhandle, const std::string& key);
|
||||
|
||||
private:
|
||||
void InternalSendMsg(int socket_handle, int msgid, google::protobuf::Message& msg, int guess_size);
|
||||
void InternalSendMsg(int socket_handle, int msgid, google::protobuf::Message& msg);
|
||||
|
||||
private:
|
||||
a8::TcpListener *tcp_listener_ = nullptr;
|
||||
|
@ -83,7 +83,7 @@ void PlayerMgr::_CMCharEnum(f8::MsgHdr& hdr, const cs::CMCharEnum& msg)
|
||||
DBEngine::Instance()->Next();
|
||||
}
|
||||
}
|
||||
GCListener::Instance()->SendMsg(hdr.socket_handle, respmsg, 100);
|
||||
GCListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
|
||||
}
|
||||
|
||||
int PlayerMgr::OnlineNum()
|
||||
|
Loading…
x
Reference in New Issue
Block a user