This commit is contained in:
aozhiwei 2019-05-27 16:25:01 +08:00
parent dd33c2b995
commit 30cfeed736
7 changed files with 16 additions and 6 deletions

View File

@ -9,8 +9,8 @@ else()
endif()
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DA8_TCP_SESSION2=1 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DA8_TCP_SESSION2=1")
include_directories(
AFTER

View File

@ -1,6 +1,7 @@
#include "precompile.h"
#include "app.h"
#include <unistd.h>
int main(int argc, char* argv[])
{
int exitcode = 0;

View File

@ -81,3 +81,8 @@ void PlayerMgr::OnClientDisconnect(a8::XParams& param)
socket_hash_.erase(socket_handle);
}
}
void PlayerMgr::RemovePlayerBySocket(int socket_handle)
{
socket_hash_.erase(socket_handle);
}

View File

@ -30,6 +30,7 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
Player* GetPlayerBySocket(int socket);
Player* CreatePlayerByCMJoin(int socket, const cs::CMJoin& msg);
void OnClientDisconnect(a8::XParams& param);
void RemovePlayerBySocket(int socket_handle);
private:
std::map<int, Player*> socket_hash_;

View File

@ -1,5 +1,8 @@
#pragma once
#define GAMESERVER_SRC 1
#define PERFT 1
#include <a8/a8.h>
#include <a8/udplog.h>
@ -17,9 +20,6 @@ namespace google
}
}
#define GAMESERVER_SRC 1
#define PERFT 1
#include "framework/cpp/types.h"
#include "framework/cpp/protoutils.h"

View File

@ -81,6 +81,9 @@ void Room::UnInit()
a8::Timer::Instance()->DeleteTimer(stats_timer_);
stats_timer_ = nullptr;
}
for (auto& pair : accountid_hash_) {
PlayerMgr::Instance()->RemovePlayerBySocket(pair.second->socket_handle);
}
for (auto& pair : uniid_hash_) {
delete pair.second;
}

@ -1 +1 @@
Subproject commit 1cf5fb6ba3f75c2b949962f9c12b39430c7ae2dc
Subproject commit fc4a7d7d241002c04aaa09dbf6d6dac91f659a04