From c53dece2b7e5fdfd6ef5e5c2ccad4029e256e803 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 3 Aug 2018 19:55:28 +0800 Subject: [PATCH] compile ok --- server/tools/scripts/construct/build_pb.py | 2 +- server/wsproxy/CMakeLists.txt | 11 ++--- server/wsproxy/GCListener.cc | 46 ++------------------ server/wsproxy/GCListener.h | 2 - server/wsproxy/app.cc | 50 +++------------------- server/wsproxy/handlermgr.cc | 32 -------------- server/wsproxy/handlermgr.h | 2 +- server/wsproxy/precompile.h | 2 +- server/wsproxy/target_conn.cc | 2 +- 9 files changed, 20 insertions(+), 129 deletions(-) diff --git a/server/tools/scripts/construct/build_pb.py b/server/tools/scripts/construct/build_pb.py index 022d375..0c50606 100644 --- a/server/tools/scripts/construct/build_pb.py +++ b/server/tools/scripts/construct/build_pb.py @@ -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') diff --git a/server/wsproxy/CMakeLists.txt b/server/wsproxy/CMakeLists.txt index bccac8b..76dcd62 100644 --- a/server/wsproxy/CMakeLists.txt +++ b/server/wsproxy/CMakeLists.txt @@ -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 diff --git a/server/wsproxy/GCListener.cc b/server/wsproxy/GCListener.cc index 6b3296a..9d120b3 100644 --- a/server/wsproxy/GCListener.cc +++ b/server/wsproxy/GCListener.cc @@ -4,15 +4,13 @@ #include #include -#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; - } - } -} diff --git a/server/wsproxy/GCListener.h b/server/wsproxy/GCListener.h index 2e759e2..7f084ba 100644 --- a/server/wsproxy/GCListener.h +++ b/server/wsproxy/GCListener.h @@ -38,8 +38,6 @@ class GCListener : public a8::Singleton 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; }; diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index 8940e5d..1531b10 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -9,19 +9,12 @@ #include #include -#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; diff --git a/server/wsproxy/handlermgr.cc b/server/wsproxy/handlermgr.cc index 512e3c2..4f8c7c5 100644 --- a/server/wsproxy/handlermgr.cc +++ b/server/wsproxy/handlermgr.cc @@ -2,15 +2,8 @@ #include -#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) diff --git a/server/wsproxy/handlermgr.h b/server/wsproxy/handlermgr.h index 6176fd4..d04571f 100644 --- a/server/wsproxy/handlermgr.h +++ b/server/wsproxy/handlermgr.h @@ -2,7 +2,7 @@ #include -#include "../common/netmsghandler.h" +#include "netmsghandler.h" namespace a8 { diff --git a/server/wsproxy/precompile.h b/server/wsproxy/precompile.h index 95b68c3..d5c9441 100644 --- a/server/wsproxy/precompile.h +++ b/server/wsproxy/precompile.h @@ -15,4 +15,4 @@ namespace google } } -#include "../common/protoutils.h" +#include "protoutils.h" diff --git a/server/wsproxy/target_conn.cc b/server/wsproxy/target_conn.cc index 207bb62..a52e0e7 100644 --- a/server/wsproxy/target_conn.cc +++ b/server/wsproxy/target_conn.cc @@ -4,7 +4,7 @@ #include "ss_proto.pb.h" #include "ss_msgid.pb.h" -#include "RSConn.h" +#include "target_conn.h" #include #include #include