diff --git a/server/wsproxy/CMakeLists.txt b/server/wsproxy/CMakeLists.txt index 89aa0eb..b5db917 100644 --- a/server/wsproxy/CMakeLists.txt +++ b/server/wsproxy/CMakeLists.txt @@ -16,8 +16,8 @@ else() endif() set(CMAKE_BUILD_TYPE "Debug") -#set(CMAKE_BUILD_TYPE "Release") -set(CMAKE_CXX_FLAGS_RELEASE "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1") +set(CMAKE_BUILD_TYPE "Release") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1") include_directories( diff --git a/server/wsproxy/GCListener.cc b/server/wsproxy/GCListener.cc index 40a4d85..7ae6e92 100644 --- a/server/wsproxy/GCListener.cc +++ b/server/wsproxy/GCListener.cc @@ -161,3 +161,8 @@ long long GCListener::GetSendNodeNum() { return tcp_listener_->send_node_num; } + +long long GCListener::GetSentBytesNum() +{ + return tcp_listener_->sent_bytes_num; +} diff --git a/server/wsproxy/GCListener.h b/server/wsproxy/GCListener.h index eaef725..962c333 100644 --- a/server/wsproxy/GCListener.h +++ b/server/wsproxy/GCListener.h @@ -32,6 +32,7 @@ class GCListener : public a8::Singleton void ForceCloseClient(unsigned short sockhandle); void MarkClient(unsigned short sockhandle, bool is_active); long long GetSendNodeNum(); + long long GetSentBytesNum(); private: a8::TcpListener *tcp_listener_ = nullptr; diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index 1464e8b..445824c 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -64,11 +64,12 @@ static void SavePerfLog() App::Instance()->perf.read_count, }); if (App::Instance()->HasFlag(2)) { - a8::XPrintf("mainloop_time:%d netmsg_time:%d send_node_num:%d\n", + a8::XPrintf("mainloop_time:%d netmsg_time:%d send_node_num:%d sent_bytes_num:%d\n", { App::Instance()->perf.max_run_delay_time, App::Instance()->perf.max_dispatchmsg_time, - GCListener::Instance()->GetSendNodeNum() + GCListener::Instance()->GetSendNodeNum(), + GCListener::Instance()->GetSentBytesNum() }); } #if 1 @@ -156,6 +157,17 @@ bool App::Init(int argc, char* argv[]) } ); } + if (HasFlag(4)) { + a8::Timer::Instance()->AddDeadLineTimer( + 1000 * 30, + a8::XParams(), + [] (const a8::XParams& param) + { + App::Instance()->shutdowned = true; + a8::XPrintf("shutdowned\n", {}); + } + ); + } return true; } diff --git a/server/wsproxy/app.h b/server/wsproxy/app.h index f452dab..16868e1 100644 --- a/server/wsproxy/app.h +++ b/server/wsproxy/app.h @@ -57,6 +57,7 @@ private: int argc = 0; char** argv = nullptr; volatile bool terminated = false; + volatile bool shutdowned = false; std::set flags; PerfMonitor perf; a8::uuid::SnowFlake uuid; diff --git a/third_party/a8engine b/third_party/a8engine index f9222e3..ca4bcdb 160000 --- a/third_party/a8engine +++ b/third_party/a8engine @@ -1 +1 @@ -Subproject commit f9222e376f8a678a252932c4a3fb93860d7625f2 +Subproject commit ca4bcdb5e2f8b32a637629f83ef152b321d97bf6