compile ok
This commit is contained in:
parent
a25f7de5c5
commit
c53dece2b7
@ -30,7 +30,7 @@ def printp_stderr(p):
|
||||
print 'build_pb stderr error:' + e
|
||||
|
||||
def need_rebuild():
|
||||
for proto_name in ('vs_proto', 'vs_msgid', 'ss_proto', 'ss_msgid'):
|
||||
for proto_name in ('ss_proto', 'ss_msgid'):
|
||||
if not os.path.isfile(proto_name + '.pb.cc'):
|
||||
return True
|
||||
s1 = os.stat(proto_name + '.pb.cc')
|
||||
|
@ -1,4 +1,4 @@
|
||||
project(masterserver)
|
||||
project(wsproxy)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ include_directories(
|
||||
/usr/include/jsoncpp
|
||||
/usr/include/python3.4m
|
||||
/usr/include/hiredis
|
||||
/var/www/html/data/framework/cpp
|
||||
)
|
||||
|
||||
link_directories(
|
||||
@ -24,7 +25,7 @@ aux_source_directory(../../third_party/a8engine/a8
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
aux_source_directory(../common
|
||||
aux_source_directory(/var/www/html/data/framework/cpp
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
@ -39,7 +40,7 @@ set(EXECUTABLE_OUTPUT_PATH
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG "_DEBUG")
|
||||
|
||||
add_executable(
|
||||
masterserver ${SRC_LIST}
|
||||
wsproxy ${SRC_LIST}
|
||||
)
|
||||
|
||||
add_custom_target(script_pb_protocol ALL)
|
||||
@ -50,10 +51,10 @@ add_custom_command(TARGET script_pb_protocol
|
||||
# COMMAND python ../../tools/script/construct/build_protocol.py
|
||||
# COMMAND python ../../tools/script/construct/build_version_file.py
|
||||
)
|
||||
add_dependencies(masterserver script_pb_protocol)
|
||||
add_dependencies(wsproxy script_pb_protocol)
|
||||
|
||||
target_link_libraries(
|
||||
masterserver
|
||||
wsproxy
|
||||
pthread
|
||||
mysqlclient
|
||||
protobuf
|
||||
|
@ -4,15 +4,13 @@
|
||||
#include <a8/websocketsession.h>
|
||||
#include <a8/tcplistener.h>
|
||||
|
||||
#include "../common/netmsghandler.h"
|
||||
#include "netmsghandler.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "GCListener.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "ss_proto.pb.h"
|
||||
#include "handlermgr.h"
|
||||
#include "player.h"
|
||||
#include "playermgr.h"
|
||||
|
||||
class GCClientSession: public a8::WebSocketSession
|
||||
{
|
||||
@ -103,10 +101,12 @@ void GCListener::SendText(unsigned short sockhandle, const std::string& text)
|
||||
void GCListener::SendErrorMsg(unsigned short sockhandle, int msgid,
|
||||
int error_code, const std::string& error_msg)
|
||||
{
|
||||
#if 0
|
||||
ss::SS_Error msg;
|
||||
msg.mutable_result()->set_error_code(error_code);
|
||||
msg.mutable_result()->set_error_msg(error_msg);
|
||||
Net_SendMsg(tcp_listener_, sockhandle, msgid, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GCListener::ForceCloseClient(unsigned short sockhandle)
|
||||
@ -118,43 +118,3 @@ void GCListener::MarkClient(unsigned short sockhandle, bool is_active)
|
||||
{
|
||||
tcp_listener_->MarkClient(sockhandle, is_active);
|
||||
}
|
||||
|
||||
void GCListener::_SS_RS_ForwardClientMsg(MsgHdr& hdr, const ss::SS_RS_ForwardClientMsg& msg)
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(msg.context().socket_handle());
|
||||
if (msg.context().src_msg_id() != cs::SMMessageId_e::_SMReConnect) {
|
||||
if (!hum || hum->session_handle != msg.context().session_handle()) {
|
||||
return;
|
||||
}
|
||||
tcp_listener_->SendClientMsg(msg.context().socket_handle(),
|
||||
msg.src_msg_head_and_body().data(),
|
||||
msg.src_msg_head_and_body().size());
|
||||
}
|
||||
|
||||
NetMsgHandler* handler = GetNetMsgHandler(&HandlerMgr::Instance()->gsmsghandler,
|
||||
msg.context().src_msg_id());
|
||||
if (handler && msg.src_msg_head_and_body().size() > sizeof(PackHead)) {
|
||||
MsgHdr gs_hdr;
|
||||
gs_hdr.msgid = msg.context().src_msg_id();
|
||||
gs_hdr.socket_handle = msg.context().socket_handle();
|
||||
gs_hdr.buf = msg.src_msg_head_and_body().data() + sizeof(PackHead);
|
||||
gs_hdr.buflen = msg.src_msg_head_and_body().size() - sizeof(PackHead);
|
||||
gs_hdr.offset = 0;
|
||||
gs_hdr.ip_saddr = msg.context().ip_saddr();
|
||||
gs_hdr.user_data = &msg.context();
|
||||
switch (handler->handlerid) {
|
||||
case HID_Player:
|
||||
{
|
||||
if (hum) {
|
||||
ProcessNetMsg(handler, hum, gs_hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HID_PlayerMgr:
|
||||
{
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), gs_hdr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,6 @@ class GCListener : public a8::Singleton<GCListener>
|
||||
void ForceCloseClient(unsigned short sockhandle);
|
||||
void MarkClient(unsigned short sockhandle, bool is_active);
|
||||
|
||||
void _SS_RS_ForwardClientMsg(MsgHdr& hdr, const ss::SS_RS_ForwardClientMsg& msg);
|
||||
|
||||
private:
|
||||
a8::TcpListener *tcp_listener_ = nullptr;
|
||||
};
|
||||
|
@ -9,19 +9,12 @@
|
||||
#include <a8/timer.h>
|
||||
#include <a8/uuid.h>
|
||||
|
||||
#include "vs_proto.pb.h"
|
||||
#include "vs_msgid.pb.h"
|
||||
|
||||
#include "../common/netmsghandler.h"
|
||||
#include "netmsghandler.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "GCListener.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "vs_msgid.pb.h"
|
||||
#include "handlermgr.h"
|
||||
#include "playermgr.h"
|
||||
#include "player.h"
|
||||
#include "roomsvrmgr.h"
|
||||
|
||||
struct MsgNode
|
||||
{
|
||||
@ -86,10 +79,8 @@ void App::Init(int argc, char* argv[])
|
||||
InitLog();
|
||||
HandlerMgr::Instance()->Init();
|
||||
a8::Timer::Instance()->Init();
|
||||
PlayerMgr::Instance()->Init();
|
||||
JsonDataMgr::Instance()->Init();
|
||||
GCListener::Instance()->Init();
|
||||
RoomSvrMgr::Instance()->Init();
|
||||
uuid.SetMachineId(instance_id);
|
||||
|
||||
a8::UdpLog::Instance()->Info("masterserver starting instance_id:%d pid:%d", {instance_id, getpid()});
|
||||
@ -112,10 +103,8 @@ void App::UnInit()
|
||||
if (terminated) {
|
||||
return;
|
||||
}
|
||||
RoomSvrMgr::Instance()->UnInit();
|
||||
GCListener::Instance()->UnInit();
|
||||
JsonDataMgr::Instance()->UnInit();
|
||||
PlayerMgr::Instance()->UnInit();
|
||||
a8::Timer::Instance()->UnInit();
|
||||
HandlerMgr::Instance()->UnInit();
|
||||
UnInitLog();
|
||||
@ -316,26 +305,17 @@ void App::ProcessClientMsg(MsgHdr& hdr)
|
||||
NetMsgHandler* handler = GetNetMsgHandler(&HandlerMgr::Instance()->gcmsghandler,
|
||||
hdr.msgid);
|
||||
if (handler) {
|
||||
#if 0
|
||||
switch (handler->handlerid) {
|
||||
case HID_PlayerMgr:
|
||||
{
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), hdr);
|
||||
}
|
||||
break;
|
||||
case HID_Player:
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr.socket_handle);
|
||||
if (hum) {
|
||||
ProcessNetMsg(handler, hum, hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#if 0
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr.socket_handle);
|
||||
if (hum) {
|
||||
hum->ForwardClientMsg(hdr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,14 +328,6 @@ void App::ProcessRoomServerMsg(MsgHdr& hdr)
|
||||
case HID_GCListener:
|
||||
ProcessNetMsg(handler, GCListener::Instance(), hdr);
|
||||
break;
|
||||
case HID_RoomSvrMgr:
|
||||
ProcessNetMsg(handler, RoomSvrMgr::Instance(), hdr);
|
||||
break;
|
||||
case HID_PlayerMgr:
|
||||
{
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), hdr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -374,12 +346,9 @@ void App::ProcessIMMsg()
|
||||
switch (im_work_node_->msgid) {
|
||||
case IM_ClientSocketDisconnect:
|
||||
{
|
||||
#if 0
|
||||
PlayerMgr::Instance()->OnClientDisconnect(pdelnode->params);
|
||||
}
|
||||
break;
|
||||
case IM_PlayerOffline:
|
||||
{
|
||||
PlayerMgr::Instance()->OnPlayerOffline(pdelnode->params);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case IM_ExecGM:
|
||||
@ -390,11 +359,6 @@ void App::ProcessIMMsg()
|
||||
);
|
||||
}
|
||||
break;
|
||||
case IM_RSConnDisconnect:
|
||||
{
|
||||
PlayerMgr::Instance()->OnRSConnDisconnect(pdelnode->params);
|
||||
}
|
||||
break;
|
||||
}
|
||||
im_work_node_ = im_work_node_->next;
|
||||
delete pdelnode;
|
||||
|
@ -2,15 +2,8 @@
|
||||
|
||||
#include <a8/mutable_xobject.h>
|
||||
|
||||
#include "vs_proto.pb.h"
|
||||
#include "vs_msgid.pb.h"
|
||||
namespace cs = kingsomevs;
|
||||
|
||||
#include "handlermgr.h"
|
||||
|
||||
#include "player.h"
|
||||
#include "playermgr.h"
|
||||
#include "roomsvrmgr.h"
|
||||
#include "GCListener.h"
|
||||
|
||||
void _GMAppEcho(a8::HTTPRequest& request, a8::MutableXObject* xobj)
|
||||
@ -32,31 +25,6 @@ void HandlerMgr::UnInit()
|
||||
|
||||
void HandlerMgr::RegisterNetMsgHandlers()
|
||||
{
|
||||
RegisterNetMsgHandler(&gcmsghandler, &PlayerMgr::_CMLogin);
|
||||
RegisterNetMsgHandler(&gcmsghandler, &PlayerMgr::_CMReConnect);
|
||||
|
||||
RegisterNetMsgHandler(&rsmsghandler, &GCListener::_SS_RS_ForwardClientMsg);
|
||||
|
||||
RegisterNetMsgHandler(&rsmsghandler, &RoomSvrMgr::_SS_Pong);
|
||||
RegisterNetMsgHandler(&rsmsghandler, &RoomSvrMgr::_SS_RS_JoinRandomRoom);
|
||||
RegisterNetMsgHandler(&rsmsghandler, &RoomSvrMgr::_SS_RS_CreateRandomRoom);
|
||||
RegisterNetMsgHandler(&rsmsghandler, &RoomSvrMgr::_SS_RS_UpdateMatchInfo);
|
||||
RegisterNetMsgHandler(&rsmsghandler, &PlayerMgr::_SS_RS_ReConnect);
|
||||
|
||||
RegisterNetMsgHandler(&gcmsghandler, &Player::_CMPing);
|
||||
RegisterNetMsgHandler(&gcmsghandler, &Player::_CMCreateRoom);
|
||||
RegisterNetMsgHandler(&gcmsghandler, &Player::_CMJoinRandomRoom);
|
||||
RegisterNetMsgHandler(&gcmsghandler, &Player::_CMJoinRoom);
|
||||
RegisterNetMsgHandler(&gcmsghandler, &Player::_CMLeaveRoom);
|
||||
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMCreateRoom);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMJoinRandomRoom);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMJoinRoom);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMKickPlayer);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMLeaveRoom);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMRoomKickPlayerNotify);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMRoomPeerLeaveNotify);
|
||||
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMRoomDisbandNotify);
|
||||
}
|
||||
|
||||
void HandlerMgr::ProcGMMsg(int sockhandle, const std::string& url, const std::string& querystr)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <a8/basehttpsession.h>
|
||||
|
||||
#include "../common/netmsghandler.h"
|
||||
#include "netmsghandler.h"
|
||||
|
||||
namespace a8
|
||||
{
|
||||
|
@ -15,4 +15,4 @@ namespace google
|
||||
}
|
||||
}
|
||||
|
||||
#include "../common/protoutils.h"
|
||||
#include "protoutils.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "ss_proto.pb.h"
|
||||
#include "ss_msgid.pb.h"
|
||||
#include "RSConn.h"
|
||||
#include "target_conn.h"
|
||||
#include <a8/tcpclient.h>
|
||||
#include <a8/udplog.h>
|
||||
#include <a8/timer.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user