Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
aea850d36e | ||
![]() |
e7219df9a5 | ||
![]() |
a27bd57c6e | ||
![]() |
9fb79fdefb |
11
server/bin/monitor.sh
Normal file
11
server/bin/monitor.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
path_arr=$(echo $PWD|tr '/' '\n')
|
||||||
|
path_arr=(${path_arr})
|
||||||
|
GAME_ID=${path_arr[-5]}
|
||||||
|
|
||||||
|
if echo $GAME_ID | grep -q '[^0-9]'
|
||||||
|
then
|
||||||
|
echo 'game_id参数必须为数字'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
python ../../third_party/tools/scripts/server/monitor.py gameserver${GAME_ID} '-n1 -i1'
|
@ -1,30 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
|
|
||||||
def getRuningProgramPids(progname):
|
|
||||||
pids = []
|
|
||||||
lines = os.popen('ps -ef | grep %s' % progname).readlines()
|
|
||||||
for l in lines:
|
|
||||||
line = ''
|
|
||||||
oldc = ''
|
|
||||||
for c in l.strip():
|
|
||||||
if c in [' ', '\t'] and c == oldc:
|
|
||||||
continue
|
|
||||||
oldc = c
|
|
||||||
line += c
|
|
||||||
line = line.split(' ')
|
|
||||||
|
|
||||||
if line[7] == './%s' % progname:
|
|
||||||
pids.append(line[1])
|
|
||||||
return pids
|
|
||||||
|
|
||||||
def monitor_gs():
|
|
||||||
while True:
|
|
||||||
pids = getRuningProgramPids('gameserver2002')
|
|
||||||
if len(pids) <= 0:
|
|
||||||
print('zzzz')
|
|
||||||
os.popen('nohup ./gameserver2002 -n1 -i1 -f1,2,4>> gameserver2002.out 2>&1 &')
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
monitor_gs()
|
|
@ -3,10 +3,15 @@ cmake_minimum_required(VERSION 2.8)
|
|||||||
|
|
||||||
set(GAME_ID 2002)
|
set(GAME_ID 2002)
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE "Debug")
|
if (${RELEASE})
|
||||||
#set(CMAKE_BUILD_TYPE "Release")
|
set(CMAKE_BUILD_TYPE "Release")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
message("release mode")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
else()
|
||||||
|
set(CMAKE_BUILD_TYPE "Debug")
|
||||||
|
message("debug mode")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DNDEBUG")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DDEBUG")
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
AFTER
|
AFTER
|
||||||
@ -19,6 +24,7 @@ include_directories(
|
|||||||
../../third_party
|
../../third_party
|
||||||
../../third_party/behaviac/inc
|
../../third_party/behaviac/inc
|
||||||
../../third_party/recastnavigation/Detour/Include
|
../../third_party/recastnavigation/Detour/Include
|
||||||
|
../../third_party/recastnavigation/DetourTileCache/Include
|
||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -40,6 +46,9 @@ aux_source_directory(../../third_party/recastnavigation/Detour/Source
|
|||||||
SRC_LIST
|
SRC_LIST
|
||||||
)
|
)
|
||||||
|
|
||||||
|
aux_source_directory(../../third_party/recastnavigation/DetourTileCache/Source
|
||||||
|
SRC_LIST
|
||||||
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND touch -a cs_proto.pb.h
|
COMMAND touch -a cs_proto.pb.h
|
||||||
@ -62,7 +71,7 @@ set(EXECUTABLE_OUTPUT_PATH
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
gameserver ${SRC_LIST}
|
gameserver${GAME_ID} ${SRC_LIST}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(script_pb_protocol ALL)
|
add_custom_target(script_pb_protocol ALL)
|
||||||
@ -70,21 +79,42 @@ add_custom_command(TARGET script_pb_protocol
|
|||||||
PRE_BUILD
|
PRE_BUILD
|
||||||
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=cs_proto,cs_msgid,ss_proto,ss_msgid,metatable --python_out=../tools/robot/virtualclient
|
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=cs_proto,cs_msgid,ss_proto,ss_msgid,metatable --python_out=../tools/robot/virtualclient
|
||||||
)
|
)
|
||||||
add_dependencies(gameserver script_pb_protocol)
|
add_dependencies(gameserver${GAME_ID} script_pb_protocol)
|
||||||
|
|
||||||
target_link_libraries(
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
gameserver
|
target_link_libraries(
|
||||||
pthread
|
gameserver${GAME_ID}
|
||||||
mysqlclient
|
pthread
|
||||||
protobuf
|
mysqlclient
|
||||||
rt
|
protobuf
|
||||||
dl
|
rt
|
||||||
util
|
dl
|
||||||
crypto
|
util
|
||||||
ssl
|
crypto
|
||||||
jsoncpp
|
ssl
|
||||||
curl
|
jsoncpp
|
||||||
hiredis
|
curl
|
||||||
tinyxml2
|
hiredis
|
||||||
behaviac_gcc_release
|
tinyxml2
|
||||||
)
|
tcmalloc
|
||||||
|
behaviac_gcc_debug
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_libraries(
|
||||||
|
gameserver${GAME_ID}
|
||||||
|
pthread
|
||||||
|
mysqlclient
|
||||||
|
protobuf
|
||||||
|
rt
|
||||||
|
dl
|
||||||
|
util
|
||||||
|
crypto
|
||||||
|
ssl
|
||||||
|
jsoncpp
|
||||||
|
curl
|
||||||
|
hiredis
|
||||||
|
tinyxml2
|
||||||
|
tcmalloc
|
||||||
|
behaviac_gcc_release
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
@ -81,6 +81,7 @@ void HandlerMgr::UnInit()
|
|||||||
void HandlerMgr::RegisterNetMsgHandlers()
|
void HandlerMgr::RegisterNetMsgHandlers()
|
||||||
{
|
{
|
||||||
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_WSP_SocketDisconnect);
|
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_WSP_SocketDisconnect);
|
||||||
|
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_Ping);
|
||||||
RegisterNetMsgHandler(&ggmsghandler, &RoomMgr::_CMJoin);
|
RegisterNetMsgHandler(&ggmsghandler, &RoomMgr::_CMJoin);
|
||||||
|
|
||||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMMove);
|
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMMove);
|
||||||
|
@ -7,13 +7,22 @@
|
|||||||
|
|
||||||
void JsonDataMgr::Init()
|
void JsonDataMgr::Init()
|
||||||
{
|
{
|
||||||
if (!f8::IsOnlineEnv() && App::Instance()->HasFlag(2)) {
|
if (!f8::IsOnlineEnv()) {
|
||||||
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver",
|
if (f8::IsTestEnv()) {
|
||||||
{
|
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.test",
|
||||||
GAME_ID,
|
{
|
||||||
App::Instance()->instance_id,
|
GAME_ID,
|
||||||
GAME_ID
|
App::Instance()->instance_id,
|
||||||
});
|
GAME_ID
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.dev",
|
||||||
|
{
|
||||||
|
GAME_ID,
|
||||||
|
App::Instance()->instance_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std::string gameserver_cluster_json_file;
|
std::string gameserver_cluster_json_file;
|
||||||
gameserver_cluster_json_file = a8::Format("%s/node%d/game%d.gameserver.cluster.json",
|
gameserver_cluster_json_file = a8::Format("%s/node%d/game%d.gameserver.cluster.json",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "playermgr.h"
|
#include "playermgr.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
|
#include "ss_proto.pb.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "metamgr.h"
|
#include "metamgr.h"
|
||||||
|
|
||||||
@ -25,6 +26,12 @@ void PlayerMgr::_SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_Socke
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerMgr::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
||||||
|
{
|
||||||
|
ss::SS_Pong respmsg;
|
||||||
|
GGListener::Instance()->SendToClient(hdr.socket_handle, 0, respmsg);
|
||||||
|
}
|
||||||
|
|
||||||
int PlayerMgr::OnlineNum()
|
int PlayerMgr::OnlineNum()
|
||||||
{
|
{
|
||||||
return socket_hash_.size();
|
return socket_hash_.size();
|
||||||
|
@ -8,6 +8,7 @@ namespace cs
|
|||||||
namespace ss
|
namespace ss
|
||||||
{
|
{
|
||||||
class SS_WSP_SocketDisconnect;
|
class SS_WSP_SocketDisconnect;
|
||||||
|
class SS_Ping;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
@ -25,6 +26,7 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
|
|||||||
void UnInit();
|
void UnInit();
|
||||||
|
|
||||||
void _SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_SocketDisconnect& msg);
|
void _SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_SocketDisconnect& msg);
|
||||||
|
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
|
||||||
|
|
||||||
int OnlineNum();
|
int OnlineNum();
|
||||||
Player* GetPlayerBySocket(int socket);
|
Player* GetPlayerBySocket(int socket);
|
||||||
|
2
third_party/a8engine
vendored
2
third_party/a8engine
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 01adda7e31f990dcb69ab54e1529bbdcd153d8de
|
Subproject commit cdb87a3e673aee3401b3e2ffce3ea1a1e6a603b0
|
2
third_party/behaviac
vendored
2
third_party/behaviac
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b9f2f205afe3226fa06b6a3b9e62fcd6eaca63b8
|
Subproject commit 240414570ee2848291d24ff8d3102dc43d4104a3
|
2
third_party/framework
vendored
2
third_party/framework
vendored
@ -1 +1 @@
|
|||||||
Subproject commit d6038d840074ee696b6c267f82091c5a1d9dc1cc
|
Subproject commit eb455bb95f97dc506566c443be0c72960ceebabf
|
2
third_party/tools
vendored
2
third_party/tools
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 093cc5830086f8a5a69e8792f8d0f16af496233c
|
Subproject commit b44f1b9c11a0bdf2711a8764343b37b5acb111cb
|
Loading…
x
Reference in New Issue
Block a user