1
This commit is contained in:
parent
65829307d6
commit
7bf02217b7
@ -268,9 +268,9 @@ void App::DispatchMsg()
|
||||
hdr.offset = 0;
|
||||
hdr.ip_saddr = pdelnode->ip_saddr;
|
||||
switch (pdelnode->sockfrom) {
|
||||
case SF_GameGate:
|
||||
case SF_GameServer:
|
||||
{
|
||||
ProcessGameGateMsg(hdr);
|
||||
ProcessGameServerMsg(hdr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -290,7 +290,7 @@ void App::DispatchMsg()
|
||||
a8::tick_t end_tick = a8::XGetTickCount();
|
||||
}
|
||||
|
||||
void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
||||
void App::ProcessGameServerMsg(f8::MsgHdr& hdr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
|
||||
void DispatchMsg();
|
||||
|
||||
void ProcessGameGateMsg(f8::MsgHdr& hdr);
|
||||
void ProcessGameServerMsg(f8::MsgHdr& hdr);
|
||||
|
||||
void InitLog();
|
||||
void UnInitLog();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
enum SocketFrom_e
|
||||
{
|
||||
SF_GameGate,
|
||||
SF_GameServer,
|
||||
};
|
||||
|
||||
enum InnerMesssage_e
|
||||
|
@ -22,18 +22,10 @@ void Player::Init(int idx,
|
||||
const std::string& session_id,
|
||||
std::shared_ptr<a8::WebSocketClient> socket)
|
||||
{
|
||||
socket_id_ = idx;
|
||||
account_id_ = account_id;
|
||||
session_id_ = session_id;
|
||||
web_socket_ = socket;
|
||||
f8::CoMgr::Instance()->CreateCo
|
||||
(
|
||||
[this] (f8::Coroutine* co)
|
||||
{
|
||||
CoLogin(co);
|
||||
});
|
||||
}
|
||||
|
||||
void Player::CoLogin(f8::Coroutine* co)
|
||||
{
|
||||
web_socket_->on_error =
|
||||
[this] (a8::WebSocketClient*,int err_code)
|
||||
@ -54,12 +46,22 @@ void Player::CoLogin(f8::Coroutine* co)
|
||||
f8::UdpLog::Instance()->Warning
|
||||
("WebSocketClient on_disconnect", {});
|
||||
};
|
||||
web_socket_->on_socketread =
|
||||
[this] (a8::WebSocketClient*, char* buf,unsigned int buflen )
|
||||
web_socket_->on_decode_userpacket =
|
||||
[this] (char* buf, int& offset, unsigned int buflen)
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
f8::CoMgr::Instance()->CreateCo
|
||||
(
|
||||
[this] (f8::Coroutine* co)
|
||||
{
|
||||
CoLogin(co);
|
||||
});
|
||||
}
|
||||
|
||||
void Player::CoLogin(f8::Coroutine* co)
|
||||
{
|
||||
{
|
||||
web_socket_->Open();
|
||||
while (!net_connected_) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
void PlayerMgr::Init()
|
||||
{
|
||||
for (int i = 0; i < 1; ++i) {
|
||||
for (int i = 1; i <= 1; ++i) {
|
||||
f8::CoMgr::Instance()->CreateCo
|
||||
(
|
||||
[this, i] (f8::Coroutine* co)
|
||||
@ -111,4 +111,5 @@ void PlayerMgr::CoCreatePlayer(f8::Coroutine* co,
|
||||
auto hum = std::make_shared<Player>();
|
||||
hum->Init(idx, account_id, session_id, socket);
|
||||
account_id_hash_[hum->GetAccountId()] = hum;
|
||||
socket_id_hash_[hum->GetSocketId()] = hum;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user