From 2c4d4ddd208ddc7fa33a0ea7ad66ece5fca6323a Mon Sep 17 00:00:00 2001
From: luotan-123 <935451190@qq.com>
Date: Sun, 26 Jul 2020 20:43:52 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E5=85=B1=E4=BA=AB?=
=?UTF-8?q?=E5=86=85=E5=AD=98=E7=9A=84=E4=BD=BF=E7=94=A8=EF=BC=8C=E5=8F=AF?=
=?UTF-8?q?=E4=BB=A5=E5=B0=86=E5=AF=B9=E8=B1=A1=E4=BF=9D=E5=AD=98=E5=88=B0?=
=?UTF-8?q?=E5=85=B1=E4=BA=AB=E5=86=85=E5=AD=98=EF=BC=8C=E5=85=B7=E4=BD=93?=
=?UTF-8?q?=E7=A4=BA=E4=BE=8B=E5=8F=82=E8=80=83TestShm=202=E3=80=81?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E7=A8=8B=E9=80=89=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CenterServer/CenterServer.vcxproj | 16 +-
linuxserverplatform/Common/Common.vcxproj | 16 +-
.../\350\256\241\345\210\222.txt" | 3 +-
.../GameManage/GameManage.vcxproj | 16 +-
linuxserverplatform/Kernel/Kernel.vcxproj | 19 +-
.../Kernel/Kernel.vcxproj.filters | 15 +
.../LoaderServer/LoaderServer.vcxproj | 16 +-
.../LogonServer/LogonServer.vcxproj | 16 +-
.../WorkServer/WorkServer.vcxproj | 16 +-
.../WorkServer/WorkServer.vcxproj.user | 41 +-
linuxserverplatform/src/Kernel/DataLine.cpp | 10 +-
linuxserverplatform/src/Kernel/Makefile | 2 +-
linuxserverplatform/src/Kernel/shmem.cpp | 331 ++++++++++
.../src/include/ServerCommon/DataLine.h | 6 +-
.../src/include/ServerCommon/KernelDefine.h | 2 +-
.../src/include/ServerCommon/shm_obj_pool.h | 584 ++++++++++++++++++
.../src/include/ServerCommon/shmem.h | 74 +++
linuxserverplatform/src/test/Makefile | 2 +-
linuxserverplatform/src/test/Shm.cpp | 120 ++++
linuxserverplatform/src/test/main.cpp | 32 +
linuxserverplatform/test/test.vcxproj | 17 +-
21 files changed, 1276 insertions(+), 78 deletions(-)
create mode 100644 linuxserverplatform/src/Kernel/shmem.cpp
create mode 100644 linuxserverplatform/src/include/ServerCommon/shm_obj_pool.h
create mode 100644 linuxserverplatform/src/include/ServerCommon/shmem.h
create mode 100644 linuxserverplatform/src/test/Shm.cpp
diff --git a/linuxserverplatform/CenterServer/CenterServer.vcxproj b/linuxserverplatform/CenterServer/CenterServer.vcxproj
index 0a72d71..90ff326 100644
--- a/linuxserverplatform/CenterServer/CenterServer.vcxproj
+++ b/linuxserverplatform/CenterServer/CenterServer.vcxproj
@@ -120,7 +120,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -132,7 +132,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -144,7 +144,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -156,7 +156,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -168,7 +168,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -180,7 +180,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -192,7 +192,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
@@ -204,7 +204,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
pthread;Kernel;Common;event;jemalloc;
diff --git a/linuxserverplatform/Common/Common.vcxproj b/linuxserverplatform/Common/Common.vcxproj
index 751daf7..5489151 100644
--- a/linuxserverplatform/Common/Common.vcxproj
+++ b/linuxserverplatform/Common/Common.vcxproj
@@ -185,7 +185,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -211,7 +211,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
@@ -237,7 +237,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -263,7 +263,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
@@ -289,7 +289,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -315,7 +315,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
@@ -341,7 +341,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -367,7 +367,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
diff --git "a/linuxserverplatform/Documentation/\350\256\241\345\210\222.txt" "b/linuxserverplatform/Documentation/\350\256\241\345\210\222.txt"
index 443330a..d00fdf8 100644
--- "a/linuxserverplatform/Documentation/\350\256\241\345\210\222.txt"
+++ "b/linuxserverplatform/Documentation/\350\256\241\345\210\222.txt"
@@ -1,9 +1,8 @@
新计划 2020/07/24:
项目修改(深度):
1、分配索引算法优化(多线程版)
-2、新增消息队列限制字节数
3、异步输出日志
-4、缓冲区改成循环缓冲区
+4、GServerConnect和TcpConnect缓冲区改成循环缓冲区(暂定不改)
5、线程间通信,高速无锁通道(队列),tbus通道
编程任务(广度):
diff --git a/linuxserverplatform/GameManage/GameManage.vcxproj b/linuxserverplatform/GameManage/GameManage.vcxproj
index 32be297..42a9da4 100644
--- a/linuxserverplatform/GameManage/GameManage.vcxproj
+++ b/linuxserverplatform/GameManage/GameManage.vcxproj
@@ -131,7 +131,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -142,7 +142,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -153,7 +153,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -164,7 +164,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -175,7 +175,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -186,7 +186,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -197,7 +197,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
@@ -208,7 +208,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteProjectDir)/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/src/SDK/lib;$(RemoteRootDir)/bin;
diff --git a/linuxserverplatform/Kernel/Kernel.vcxproj b/linuxserverplatform/Kernel/Kernel.vcxproj
index 456b325..632480b 100644
--- a/linuxserverplatform/Kernel/Kernel.vcxproj
+++ b/linuxserverplatform/Kernel/Kernel.vcxproj
@@ -130,6 +130,7 @@
+
@@ -156,6 +157,8 @@
+
+
@@ -163,7 +166,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -184,7 +187,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -205,7 +208,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -226,7 +229,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -247,7 +250,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -268,7 +271,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -289,7 +292,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
@@ -310,7 +313,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include;$(RemoteProjectDir)/src/include/ServerCommon;../src/include/ServerCommon
diff --git a/linuxserverplatform/Kernel/Kernel.vcxproj.filters b/linuxserverplatform/Kernel/Kernel.vcxproj.filters
index 828d31f..485de65 100644
--- a/linuxserverplatform/Kernel/Kernel.vcxproj.filters
+++ b/linuxserverplatform/Kernel/Kernel.vcxproj.filters
@@ -34,6 +34,12 @@
{82a5bb52-2846-4b6f-b921-9803fbb1eeb5}
+
+ {c57b9d39-c8e1-4245-ae3d-f42917926b42}
+
+
+ {581ab7b9-3d67-4063-b25a-f5607f549283}
+
@@ -108,6 +114,12 @@
异常处理
+
+ 共享内存
+
+
+ 共享内存
+
@@ -167,5 +179,8 @@
工具和接口
+
+ 共享内存
+
\ No newline at end of file
diff --git a/linuxserverplatform/LoaderServer/LoaderServer.vcxproj b/linuxserverplatform/LoaderServer/LoaderServer.vcxproj
index 2ca772a..8b9eccf 100644
--- a/linuxserverplatform/LoaderServer/LoaderServer.vcxproj
+++ b/linuxserverplatform/LoaderServer/LoaderServer.vcxproj
@@ -132,7 +132,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -148,7 +148,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -164,7 +164,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -180,7 +180,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -196,7 +196,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -212,7 +212,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -228,7 +228,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
@@ -244,7 +244,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
$(RemoteRootDir)/bin;
diff --git a/linuxserverplatform/LogonServer/LogonServer.vcxproj b/linuxserverplatform/LogonServer/LogonServer.vcxproj
index ad1a2d2..3e3a979 100644
--- a/linuxserverplatform/LogonServer/LogonServer.vcxproj
+++ b/linuxserverplatform/LogonServer/LogonServer.vcxproj
@@ -126,7 +126,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -138,7 +138,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -150,7 +150,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -162,7 +162,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -174,7 +174,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -186,7 +186,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -198,7 +198,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
@@ -210,7 +210,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;../src/include/ServerCommon
$(RemoteRootDir)/bin;
diff --git a/linuxserverplatform/WorkServer/WorkServer.vcxproj b/linuxserverplatform/WorkServer/WorkServer.vcxproj
index 6b2f909..f3050e6 100644
--- a/linuxserverplatform/WorkServer/WorkServer.vcxproj
+++ b/linuxserverplatform/WorkServer/WorkServer.vcxproj
@@ -122,7 +122,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -135,7 +135,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
@@ -148,7 +148,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -161,7 +161,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
@@ -174,7 +174,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -187,7 +187,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
@@ -200,7 +200,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
LUA_COMPAT_5_1;
@@ -213,7 +213,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/Common/src/lua;../src/include/ServerCommon;%(AdditionalIncludeDirectories)
NDEBUG;LUA_COMPAT_5_1;%(PreprocessorDefinitions)
diff --git a/linuxserverplatform/WorkServer/WorkServer.vcxproj.user b/linuxserverplatform/WorkServer/WorkServer.vcxproj.user
index 88a5509..c7be611 100644
--- a/linuxserverplatform/WorkServer/WorkServer.vcxproj.user
+++ b/linuxserverplatform/WorkServer/WorkServer.vcxproj.user
@@ -1,4 +1,43 @@
-
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
+
+ $(RemoteTargetPath)
+ $(RemoteRootDir)/bin/
+ LinuxDebugger
+
\ No newline at end of file
diff --git a/linuxserverplatform/src/Kernel/DataLine.cpp b/linuxserverplatform/src/Kernel/DataLine.cpp
index 870b80b..c1b6ef1 100644
--- a/linuxserverplatform/src/Kernel/DataLine.cpp
+++ b/linuxserverplatform/src/Kernel/DataLine.cpp
@@ -74,7 +74,7 @@ UINT CDataLine::AddData(DataLineHead* pDataInfo, UINT uAddSize, UINT uDataKind,
m_DataList.push_back(pListItem); //加到队列尾部
- m_DataListSize++;
+ m_DataListSize += pListItem->stDataHead.uSize + 1;
LockObject.UnLock();
@@ -101,13 +101,13 @@ UINT CDataLine::GetData(DataLineHead** pDataBuffer)
LockObject.Lock();
//进入挂起状态
- if (m_DataListSize <= 0)
+ if (m_DataList.size() <= 0)
{
m_csLock.Wait();
}
//如果队列是空的,直接返回
- if (m_DataListSize <= 0)
+ if (m_DataList.size() <= 0)
{
return 0;
}
@@ -116,7 +116,7 @@ UINT CDataLine::GetData(DataLineHead** pDataBuffer)
ListItemData* pListItem = m_DataList.front();
m_DataList.pop_front();
- m_DataListSize--;
+ m_DataListSize -= pListItem->stDataHead.uSize + 1;
LockObject.UnLock();
@@ -153,5 +153,5 @@ bool CDataLine::CleanLineData()
// 获取队列数据数量
size_t CDataLine::GetDataCount()
{
- return m_DataListSize;
+ return m_DataList.size();
}
diff --git a/linuxserverplatform/src/Kernel/Makefile b/linuxserverplatform/src/Kernel/Makefile
index 4839936..f9a03ba 100644
--- a/linuxserverplatform/src/Kernel/Makefile
+++ b/linuxserverplatform/src/Kernel/Makefile
@@ -7,7 +7,7 @@ LIBS = -lpthread -lcurl -lmysqlclient -levent -levent_pthreads -ljemalloc
BINDIR := ../bin/
BIN := libKernel.so
-OBJ := jemalloc_cpp.o base64.o configManage.o DataBase.o DataLine.o Exception.o Function.o GameLogManage.o GServerConnect.o INIFile.o Lock.o log.o MysqlHelper.o ServerTimer.o sha1.o TcpConnect.o TCPSocket.o WebSocket.o Xor.o
+OBJ := jemalloc_cpp.o base64.o configManage.o DataBase.o DataLine.o Exception.o Function.o GameLogManage.o GServerConnect.o INIFile.o Lock.o log.o MysqlHelper.o ServerTimer.o sha1.o TcpConnect.o TCPSocket.o WebSocket.o Xor.o shmem.o
$(BINDIR)$(BIN):$(OBJ)
$(CPP) -o $@ $(LDFLAGS) $^ $(LIBS)
diff --git a/linuxserverplatform/src/Kernel/shmem.cpp b/linuxserverplatform/src/Kernel/shmem.cpp
new file mode 100644
index 0000000..b2b0db4
--- /dev/null
+++ b/linuxserverplatform/src/Kernel/shmem.cpp
@@ -0,0 +1,331 @@
+#ifndef _SHMEN_CPP_
+#define _SHMEN_CPP_
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "shmem.h"
+#include
+#include
+#include "CommonHead.h"
+#include "log.h"
+
+// #ifdef _DEBUG_ //先只在Debug环境下开
+#define MEM_PROTECT_PAGE_TURN_ON
+// #endif
+
+#define MEM_PAGE_SIZE 4096 //内存页大小
+
+//内存地址对齐一页
+#ifdef MEM_PROTECT_PAGE_TURN_ON
+static void* AlignPage(void* pMem, size_t* pAddLen)
+{
+ void* pNewMem = (void*)(((size_t)pMem + MEM_PAGE_SIZE - 1) / MEM_PAGE_SIZE * MEM_PAGE_SIZE);
+ if (pAddLen != NULL)
+ *pAddLen = (char*)pNewMem - (char*)pMem;
+ return pNewMem;
+}
+#endif
+
+int CShmem::ms_iKeyToAddrNum = 0; //当前已经存在的共享内存个数
+STShmKeyToAddress CShmem::ms_stKeyToAddr[MAX_KEY_TO_ADDRESS_NUM]; //共享内存到地址数组
+bool CShmem::m_bShmRecordInfoVecInit = false;
+ShmRecordInfoVec CShmem::m_ShmRecordInfoVec;
+
+CShmem::CShmem()
+{}
+
+CShmem::~CShmem()
+{}
+
+void* CShmem::CreateShmem(const int aiKey, const unsigned int aiTotalSize, const unsigned int aiNeedSize, const char* pFile, int iLine, int aiMode)
+{
+ RecordShmInfo(aiKey, aiTotalSize, aiNeedSize);
+
+ STShmKeyToAddress* pstKeyToAddr = FindAddrOfKey(aiKey, aiTotalSize);
+ if (NULL != pstKeyToAddr)
+ {
+#ifdef MEM_PROTECT_PAGE_TURN_ON
+ //从第二次分配开始 两次分配之间 增加一个保护页
+ size_t uAdditionLen = 0;
+ void* pPreMem = ((char*)pstKeyToAddr->m_vpMemAddr + pstKeyToAddr->m_uiOffset);
+ void* pProtectMem = AlignPage(pPreMem, &uAdditionLen);
+ void* pMem = (char*)pProtectMem + MEM_PAGE_SIZE;
+ uAdditionLen += MEM_PAGE_SIZE;
+
+ if (pstKeyToAddr->m_uiOffset + uAdditionLen + aiNeedSize > (unsigned int)pstKeyToAddr->m_iSize)
+ {
+ ERROR_LOG("CreatShmem fail. offset+additionsize+needsize:%u > keysize:%u\n",
+ pstKeyToAddr->m_uiOffset + (unsigned int)uAdditionLen + (unsigned int)aiNeedSize,
+ (unsigned int)pstKeyToAddr->m_iSize);
+ return NULL;
+ }
+
+ //保护页地址用ERR日志打出来,方便定位问题
+ fprintf(stderr, "CreateShmem mprotect page: %p %u\n", pProtectMem, MEM_PAGE_SIZE);
+ ERROR_LOG("CreateShmem mprotect page: %p %u\n", pProtectMem, MEM_PAGE_SIZE);
+
+ int iRet = mprotect(pProtectMem, MEM_PAGE_SIZE, PROT_NONE); //保护页不可访问
+ if (iRet != 0)
+ {
+ ERROR_LOG("CreateShmem mprotect failed %d\n", iRet);
+ perror("CreateShmem mprotect");
+ return NULL;
+ }
+
+ pstKeyToAddr->m_uiOffset += (unsigned int)uAdditionLen + (unsigned int)aiNeedSize;
+ pstKeyToAddr->m_iCount++;
+
+ INFO_LOG("[exist]share memory key:%u, seq:%d, needsize:%u, total(shmall:%u, shmused:%u: shmleft:%u).\n",
+ aiKey, pstKeyToAddr->m_iCount, aiNeedSize, aiTotalSize, pstKeyToAddr->m_uiOffset, aiTotalSize - pstKeyToAddr->m_uiOffset);
+
+
+ //查找是否已经存在本地
+ INFO_LOG("%s file %s line %d key %d addr %p size %d", __PRETTY_FUNCTION__, pFile, iLine, aiKey, pMem, aiNeedSize);
+
+ return pMem;
+#else
+ if (pstKeyToAddr->m_uiOffset + aiNeedSize > (unsigned int)pstKeyToAddr->m_iSize)
+ {
+ ERROR_LOG("CreatShmem fail. offset+needsize:%u > keysize:%u\n",
+ pstKeyToAddr->m_uiOffset + (unsigned int)aiNeedSize,
+ (unsigned int)pstKeyToAddr->m_iSize);
+ return NULL;
+ }
+ void* pvMem = (void*)(((char*)pstKeyToAddr->m_vpMemAddr) + pstKeyToAddr->m_uiOffset);
+ pstKeyToAddr->m_uiOffset += (unsigned int)aiNeedSize;
+ pstKeyToAddr->m_iCount++;
+
+ ErrorLog("%s file %s line %d key %d addr %p size %d", __PRETTY_FUNCTION__, pFile, iLine, aiKey, pvMem, aiNeedSize);
+
+ RecordLog(GetLogCat(), TLL_CRIT, "[exist]share memory key:%u, seq:%d, needsize:%u, total(shmall:%u, shmused:%u: shmleft:%u).\n",
+ aiKey, pstKeyToAddr->m_iCount, aiNeedSize, aiTotalSize, pstKeyToAddr->m_uiOffset, aiTotalSize - pstKeyToAddr->m_uiOffset);
+
+ return pvMem;
+#endif
+ }
+ //不在本地则通过系统获得
+ int iHandle = -1;
+ ENMShmStartMode enmMode = ESSM_Init;
+ void* pvMem = NULL;
+ if ((iHandle = shmget(aiKey, aiTotalSize, aiMode | IPC_CREAT | IPC_EXCL)) < 0)
+ {
+ if (errno == EEXIST)
+ {
+ enmMode = ESSM_Resume;
+
+ if ((iHandle = shmget(aiKey, aiTotalSize, aiMode)) != -1)
+ {
+ pvMem = (char*)shmat(iHandle, 0, 0);
+ if (-1 == (int64_t)pvMem)
+ {
+ printf("shmat(EEXIST) %m\n");
+ ERROR_LOG("shmat(%d) shmget(%d,%d,%d) err=%m\n", iHandle, aiKey, aiTotalSize, aiMode);
+ return NULL;
+ }
+ }
+ else
+ {
+ printf("shmget(EEXIST) = %d %m\n", iHandle);
+ ERROR_LOG("shmget(%d,%d,%d) err=%m\n", aiKey, aiTotalSize, aiMode);
+
+ return NULL;
+ }
+ }
+ else
+ {
+ printf("shmget() = %d %m\n", iHandle);
+ ERROR_LOG(" errno != EEXIST shmget(%d,%d,%d) err=%m\n", aiKey, aiTotalSize, aiMode);
+ return NULL;
+ }
+ }
+ else
+ {
+ enmMode = ESSM_Init;
+ pvMem = (char*)shmat(iHandle, 0, 0);
+ if (-1 == (int64_t)pvMem)
+ {
+ printf("shmgat(Error) = %m %d\n", iHandle);
+ ERROR_LOG("shmat(%d) err=%m\n", iHandle);
+
+ return NULL;
+ }
+ //因为这样会导致程序启动必然使用全部分配的空间
+ //所以去掉,由分配者自行初始化
+ //初始创建置为0
+ //memset(pvMem, 0, aiTotalSize);
+
+ /**
+ * 为了预防一些内存没有被初始化的BUG,在测试环境将所有内存初始化为-1,如果有未初始化的可以立刻定位到问题
+ * @add by arrowgu
+ */
+
+#ifdef _DEBUG_
+ memset(pvMem, -1, aiTotalSize);
+#endif
+
+ }
+
+ //查找是否已经存在本地
+ INFO_LOG("%s file %s line %d key %d addr %p size %d", __PRETTY_FUNCTION__, pFile, iLine, aiKey, pvMem, aiNeedSize);
+
+ STShmKeyToAddress stKeyToAddr = { 0 };
+ stKeyToAddr.m_iKey = aiKey;
+ stKeyToAddr.m_iSize = aiTotalSize;
+ stKeyToAddr.m_enmStartMode = enmMode;
+ stKeyToAddr.m_vpMemAddr = pvMem;
+ stKeyToAddr.m_iCount = 1;
+ if (aiNeedSize > aiTotalSize)
+ {
+ stKeyToAddr.m_uiOffset = 0;
+ pvMem = NULL;
+ }
+ else
+ {
+ stKeyToAddr.m_uiOffset = (unsigned int)aiNeedSize;
+
+ INFO_LOG("[first]share memory key:%u, seq:%d, needsize:%u, total(shmall:%u, shmused:%u: shmleft:%u) startmode(%d).\n",
+ aiKey, stKeyToAddr.m_iCount, aiNeedSize, aiTotalSize, stKeyToAddr.m_uiOffset, aiTotalSize - stKeyToAddr.m_uiOffset,
+ enmMode);
+ }
+
+ AddOneKeyToAddress(stKeyToAddr);
+
+ return pvMem;
+}
+
+int CShmem::DestroyShmem(const int aiKey, const unsigned int aiTotalSize)
+{
+ int iHandle = shmget(aiKey, aiTotalSize, 0640 | IPC_EXCL);
+
+ if (iHandle >= 0)
+ {
+ DelOneKeyToAddress(aiKey, aiTotalSize);
+ shmctl(iHandle, IPC_RMID, 0);
+ }
+
+ return 0;
+}
+
+ENMShmStartMode CShmem::GetStartFlag(const int aiKey, const int aiTotalSize)
+{
+ //查找是否已经存在
+ STShmKeyToAddress* pstKeyToAddr = FindAddrOfKey(aiKey, aiTotalSize);
+ if (NULL != pstKeyToAddr)
+ {
+ return pstKeyToAddr->m_enmStartMode;
+ }
+
+ return ESSM_Init;
+}
+
+STShmKeyToAddress* CShmem::FindAddrOfKey(const int aiKey, const int aiTotalSize)
+{
+ for (int i = 0; i < ms_iKeyToAddrNum; ++i)
+ {
+ if ((ms_stKeyToAddr[i].m_iKey == aiKey) && (ms_stKeyToAddr[i].m_iSize == aiTotalSize))
+ {
+ return &ms_stKeyToAddr[i];
+ }
+ }
+ return NULL;
+}
+
+int CShmem::AddOneKeyToAddress(STShmKeyToAddress& stKeyToAddr)
+{
+ if (ms_iKeyToAddrNum >= MAX_KEY_TO_ADDRESS_NUM)
+ {
+ printf("key to address is full\n");
+ return -1;
+ }
+
+ ms_stKeyToAddr[ms_iKeyToAddrNum] = stKeyToAddr;
+
+ ++ms_iKeyToAddrNum;
+
+ return 0;
+}
+
+int CShmem::DelOneKeyToAddress(const int aiKey, const int aiTotalSize)
+{
+ int i = 0;
+ for (i = 0; i < ms_iKeyToAddrNum; ++i)
+ {
+ if ((ms_stKeyToAddr[i].m_iKey == aiKey) && (ms_stKeyToAddr[i].m_iSize == aiTotalSize))
+ {
+ break;
+ }
+ }
+ if (i < ms_iKeyToAddrNum)
+ {
+ for (; i < ms_iKeyToAddrNum - 1; ++i)
+ {
+ ms_stKeyToAddr[i] = ms_stKeyToAddr[i + 1];
+ }
+ --ms_iKeyToAddrNum;
+ return 0;
+ }
+ return -1;
+}
+
+void CShmem::RecordShmInfo(int iShmKey, unsigned int dwTotalSize, unsigned int dwNeedSize)
+{
+ if (!m_bShmRecordInfoVecInit)
+ {
+ m_ShmRecordInfoVec.clear();
+ m_bShmRecordInfoVecInit = true;
+ }
+
+ static int siIdx = 1;
+ tagShmRecordNode stNode = { 0 };
+ stNode.iIdx = siIdx;
+ stNode.iShmKey = iShmKey;
+ stNode.dwTotalSize = dwTotalSize;
+ stNode.dwNeedSize = dwNeedSize;
+ m_ShmRecordInfoVec.push_back(stNode);
+ ++siIdx;
+}
+
+void CShmem::LogShmInfo()
+{
+ if (!m_bShmRecordInfoVecInit)
+ {
+ ERROR_LOG("%s, ShmRecordInfoVec not Init", __PRETTY_FUNCTION__);
+ return;
+ }
+
+ bool bErrLog = true;
+ char szLogName[128];
+ snprintf(szLogName, sizeof(szLogName), "../log/ZoneShmInfoRecord_%u.log", (unsigned int)time(NULL));
+ std::ofstream logfile(szLogName);
+ if (logfile.is_open())
+ {
+ bErrLog = false;
+ }
+
+ ShmRecordInfoVec::iterator iter;
+ iter = m_ShmRecordInfoVec.begin();
+ while (m_ShmRecordInfoVec.end() != iter)
+ {
+ //bErrLog为true时,记录到zone的error日志里
+ if (bErrLog)
+ {
+ ERROR_LOG("%s Idx %d Key %d TotalSize %u NeedSize %u", __FUNCTION__, iter->iIdx,
+ iter->iShmKey, iter->dwTotalSize, iter->dwNeedSize);
+ }
+ else //否则就是记录在有时间戳命名的单独文件里
+ {
+ logfile << iter->iIdx << " " << iter->iShmKey << " " << iter->dwTotalSize << " " << iter->dwNeedSize << "\n";
+ }
+ ++iter;
+ }
+}
+
+
+#endif
+
diff --git a/linuxserverplatform/src/include/ServerCommon/DataLine.h b/linuxserverplatform/src/include/ServerCommon/DataLine.h
index 6f4b678..46712c1 100644
--- a/linuxserverplatform/src/include/ServerCommon/DataLine.h
+++ b/linuxserverplatform/src/include/ServerCommon/DataLine.h
@@ -3,8 +3,8 @@
#include "Lock.h"
#include "InternalMessageDefine.h"
-// 消息队列最大长度
-#define MAX_DATALINE_LEN 320000
+// 消息队列最大字节数量
+const unsigned int MAX_DATALINE_LEN = 10 * 1024 * 1024;
/*
Struct :ListItemData
@@ -23,7 +23,7 @@ struct ListItemData
class CDataLine
{
private:
- volatile size_t m_DataListSize;
+ unsigned int m_DataListSize;
std::list m_DataList;
CSignedLock m_csLock;
diff --git a/linuxserverplatform/src/include/ServerCommon/KernelDefine.h b/linuxserverplatform/src/include/ServerCommon/KernelDefine.h
index 159c464..4b6d54f 100644
--- a/linuxserverplatform/src/include/ServerCommon/KernelDefine.h
+++ b/linuxserverplatform/src/include/ServerCommon/KernelDefine.h
@@ -28,7 +28,7 @@ const int MAX_DB_NAME_SIZE = 48; // 最大db_name缓冲区大小
const int MAX_LOG_BUF_SIZE = 1024; // log缓冲区大小
const int MAX_FILE_NAME_SIZE = 256; // 最大文件名长度
const int MAX_FUNC_NAME_SIZE = 128; // 最大函数名长度
-const int MAX_LOG_FILE_SIZE = 1024 * 1024 * 32; //日子文件的最大的长度,超过长度会生成新的文件
+const int MAX_LOG_FILE_SIZE = 1024 * 1024 * 30; //日子文件的最大的长度,超过长度会生成新的文件
const int MAX_BANK_PASSWD_MIN_LEN = 6; // 银行密码最小长度
diff --git a/linuxserverplatform/src/include/ServerCommon/shm_obj_pool.h b/linuxserverplatform/src/include/ServerCommon/shm_obj_pool.h
new file mode 100644
index 0000000..ddeb31f
--- /dev/null
+++ b/linuxserverplatform/src/include/ServerCommon/shm_obj_pool.h
@@ -0,0 +1,584 @@
+/**
+* @file
+* @brief 共享内存对象池:预分配对象空间,并提供访问接口。
+*
+* @note tab=4.
+*/
+
+#ifndef _XG_SHM_OBJ_POOL_H_
+#define _XG_SHM_OBJ_POOL_H_
+
+#include
+#include
+#include
+#include "shmem.h"
+#include "log.h"
+
+
+//class CZoneConfMgr;
+//CZoneConfMgr *GetZoneConfMgr ();
+
+
+
+//#include "zone_def.h"
+
+//extern LPTLOGCATEGORYINST GetLogCat();
+
+
+struct tagObjPoolHead
+{
+ int iType; //< 类型。正整数。
+ int iUint; //< 单个T的空间大小。
+ int iNum; //< 个体的数量。
+ int iKey; //< shm key。0 为不起作用。
+ int iSize; //< shm size。0 为不起作用。
+ int iOffSet; //< 偏移量。
+ int iFreeHead; //< 空闲头。head=tail表示空。
+ int iFreeTail; //< 空闲尾。
+ int iUseNum; //< 已经使用的大小。
+ int* piFreeArray; //< 空闲数组。
+ char* pcUsedArray; //< 标示是否使用。0 为未使用,1为使用中。和pszData对应的存储对象一一对应。
+ char* pszData; //< 存储空间。
+};
+
+typedef tagObjPoolHead OBJPOOLHEAD;
+typedef tagObjPoolHead* LPOBJPOOLHEAD;
+
+template
+class CShmObjPool
+{
+public:
+
+ CShmObjPool() { ; }
+ virtual ~CShmObjPool() { ; }
+
+
+ /**
+ * @brief 创建共享内存并分配空间。
+ * @return >0 为创建改类型对象池的总空间大小.<0 when fail,注意0号位对象不能被存储,实际可使用空间aiNum-1
+ */
+ int CreateObjPool(const int aiKey, const int aiTotalSize, const int aiUint, const int aiNum, int aiType, const char* pFile, int iLine);
+
+ ENMShmStartMode GetStartFlag();
+
+ //added by shasharui 20090512 start
+ /**
+ * @brief 通过下标,获取该对象的指针。
+ * @param aiIndex - 需要的对象的下标。
+ * @param aiType - 对象的类型。用于校验。
+ * @return 不管用没用,强制取出来,不保证已经被用了,谨慎使用
+ */
+ T* ForceGetObj(const int aiIndex, const int aiType);
+ //added by shasharui 20090512 end
+
+ /**
+ * @brief 通过下标,获取该对象的指针。
+ * @param aiIndex - 需要的对象的下标。
+ * @param aiType - 对象的类型。用于校验。
+ * @return NULL 为查找不到。not NULL为该对象指针。
+ */
+ inline T* GetObj(const int aiIndex, const int aiType)
+ {
+ /*
+ m_iErrCode = 0;
+
+ if (m_pHead->iType != aiType)
+ {
+ m_iErrCode = -1;
+ return NULL;
+ }
+ if (aiIndex >= m_pHead->iNum || aiIndex < 0)
+ {
+ m_iErrCode = -2;
+ return NULL;
+ }
+ if (0 == m_pHead->pcUsedArray[aiIndex])
+ {
+ m_iErrCode = -3;
+ return NULL;
+ }else
+ return &(m_pObjHead[aiIndex]);
+ */
+
+ if (m_pHead->iType == aiType && aiIndex >= 0 && aiIndex < m_pHead->iNum
+ && 0 != m_pHead->pcUsedArray[aiIndex])
+ {
+ m_iErrCode = 0;
+ return &(m_pObjHead[aiIndex]);
+ }
+ else
+ {
+ m_iErrCode = -1;
+ return NULL;
+ }
+
+ }
+
+ /**
+ * @brief 获取空闲的对象空间。
+ * @param aiType - 对象的类型。
+ * @param aiIndex - 返回该对象的下标。
+ * @return NULL 为没有空间分配。not NULL为分配的对象指针。
+ */
+ T* GetFreeObj(const int aiType, int* aiIndex);
+
+ /**
+ * @brief 释放对象空间。
+ * @param aitype - 对象的类型。
+ * @param aiIndex - 需要释放的对象下标。
+ * @return 0 when ok。
+ */
+ int FreeObj(const int aiType, const int aiIndex);
+
+ /**
+ * @param aiFlag - 标示是否打印空闲数组和使用标示数组。0为不打印,1为打印。
+ */
+ void PrintHead(int aiFlag = 0);
+
+ LPOBJPOOLHEAD GetHead()
+ {
+ return m_pHead;
+ }
+
+ int GetErrCode()
+ {
+ return m_iErrCode;
+ }
+
+ /**
+ * @brief 处理所有的节点。
+ * @note ProcessObj返回2120会终止遍历
+ *
+ */
+ int ProcessAllObj(int (*ProcessObj)(T*));
+
+ /**
+ * @brief 处理所有的节点,可以通过传入的参数执行不同的操作
+ *
+ */
+ int ProcessAllObj(int (*ProcessObj)(T*, void*, int, int), void* pArg, int iLen, int iType);
+
+ /**
+ * @brief 处理所有的节点,可传入参数和开始遍历的下标
+ * @note ProcessObj返回200会终止遍历
+ *
+ */
+ int ProcessAllObj(int (*ProcessObj)(T*, void*, int, int), void* pArg, int iLen, int iType, int iStartIdx);
+
+ /**
+ * @brief 返回已使用的obj数量
+ */
+ int GetUseNum()
+ {
+ return m_pHead->iUseNum;
+ }
+
+ /**
+ * @brief 返回空闲的obj数量
+ */
+ int GetFreeNum()
+ {
+ return (m_pHead->iNum - m_pHead->iUseNum);
+ }
+
+ /**
+ * @brief 返回单个obj大小
+ */
+ int GetUnitSize() { return m_pHead->iUint; }
+
+ /**
+ * @brief 返回使用的共享内存大小
+ */
+ int GetShmSize()
+ {
+ return (sizeof(OBJPOOLHEAD) + m_pHead->iNum * (sizeof(int) + sizeof(char) + m_pHead->iUint));
+ }
+
+
+protected:
+ /**
+ *
+ */
+ int InitFreeArray();
+
+ int InitUsedArray();
+
+ int InitAllObj(ENMShmStartMode enmMode);
+
+ bool CheckShm();
+
+protected:
+
+
+ /// head + 空闲数组队列 + 是否分配的标示 + 对象空间。
+ LPOBJPOOLHEAD m_pHead;
+ T* m_pObjHead;
+
+ int m_iErrCode;
+};
+
+template
+int CShmObjPool::InitFreeArray()
+{
+ ///<第一次使用该内存时,需要先把空闲数组的值初始化为Obj空间的下标。
+
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ m_pHead->piFreeArray[i] = i;
+ }
+ return 0;
+}
+
+template
+int CShmObjPool::InitAllObj(ENMShmStartMode enmMode)
+{
+ T* lpoObj = NULL;
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ lpoObj = &(m_pObjHead[i]);
+ lpoObj = (T*)T::CreateObject((void*)lpoObj);
+ if (ESSM_Init == enmMode)
+ {
+ lpoObj->Init();
+ }
+ else
+ {
+ lpoObj->Resume();
+ }
+ }
+
+ return 0;
+}
+
+template
+int CShmObjPool::InitUsedArray()
+{
+ //< 第一次使用该内存时,需要把是否使用数组初始化为 未使用。建立共享内存时直接memset 为0了。
+ return 0;
+}
+
+template
+int CShmObjPool::CreateObjPool(const int aiKey, const int aiTotalSize, const int aiUint, const int aiNum, int aiType, const char* pFile, int iLine)
+{
+ //< 判断是否已经创建共享内存。
+ CShmem loShmem;
+
+ //< 数据结构: 包头 + 空闲数组 + 标示是否使用数组+实际对象空间。
+ uint64_t ullNeedSize = sizeof(OBJPOOLHEAD) + sizeof(int) * aiNum + sizeof(char) * aiNum + aiUint * aiNum;
+ if (ullNeedSize > 0xFFFFFFFF)
+ {
+ ERROR_LOG("ullNeedSize = %llu too large!\n", ullNeedSize);
+ return 0;
+ }
+
+ int iNeedSize = ullNeedSize & 0xFFFFFFFF;
+
+ //GetZoneConfMgr()->RecordShmInfo(aiKey, aiTotalSize, iNeedSize);
+
+ char* lpszShm = (char*)loShmem.CreateShmem(aiKey, aiTotalSize, iNeedSize, pFile, iLine);
+ if (lpszShm == NULL)
+ {
+ return -1;
+ }
+
+ /// 数据结构: 包头 + 空闲数组 + 标示是否使用数组+实际对象空间。
+ //< 没有校验数据空间大小是否超过共享内存分配的大小。后续增加。
+ ENMShmStartMode enmMode = loShmem.GetStartFlag(aiKey, aiTotalSize);
+ if (ESSM_Resume == enmMode)
+ {
+ m_pHead = (LPOBJPOOLHEAD)lpszShm;
+
+ //检查代码是否改变了对象池的对象大小、个数和类型
+ if (aiUint != m_pHead->iUint || aiNum != m_pHead->iNum || aiType != m_pHead->iType)
+ {
+ ERROR_LOG("error in CreateObjPool, shm needed changed! aiKey(%d), request(%d, %d, %d), shm(%d, %d, %d)\n",
+ aiKey, aiUint, aiNum, aiType, m_pHead->iUint, m_pHead->iNum, m_pHead->iType);
+ return -1;
+ }
+
+ int liOffSet = sizeof(OBJPOOLHEAD);
+ m_pHead->piFreeArray = (int*)(lpszShm + liOffSet);
+
+ liOffSet += sizeof(int) * m_pHead->iNum;
+ m_pHead->pcUsedArray = (char*)(lpszShm + liOffSet);
+
+ liOffSet += sizeof(char) * m_pHead->iNum;
+ m_pHead->pszData = lpszShm + liOffSet;
+ m_pObjHead = (T*)m_pHead->pszData;
+
+ if (!CheckShm())
+ {
+ ERROR_LOG("check shm error! CShmObjPool key[%d], size[%d] , mod[init], address[%p], uint[%d: %d+%d*%d]\n",
+ aiKey, aiTotalSize, lpszShm, aiType, iNeedSize, aiUint, aiNum);
+ return -1;
+ }
+ // RecordLog(GetLogCat(), TLL_TRACE, "shm has existed!key[%d], size[%d]\n", m_pHead->iKey, m_pHead->iSize);
+ }
+ else
+ {
+ memset(lpszShm, 0, iNeedSize);
+
+ m_pHead = (LPOBJPOOLHEAD)lpszShm;
+ m_pHead->iUint = aiUint;
+ m_pHead->iType = aiType;
+ m_pHead->iNum = aiNum;
+ m_pHead->iKey = aiKey;
+ m_pHead->iSize = aiTotalSize;
+
+ int liOffSet = sizeof(OBJPOOLHEAD);
+ m_pHead->piFreeArray = (int*)(lpszShm + liOffSet);
+ InitFreeArray();
+
+ liOffSet += sizeof(int) * m_pHead->iNum;
+ m_pHead->pcUsedArray = (char*)(lpszShm + liOffSet);
+
+ liOffSet += sizeof(char) * m_pHead->iNum;
+ m_pHead->pszData = lpszShm + liOffSet;
+ m_pObjHead = (T*)m_pHead->pszData;
+
+ }
+
+ InitAllObj(enmMode);
+
+ if (ESSM_Init == enmMode)
+ {
+ INFO_LOG("%s key[%d], size[%d] , mod[init], address[%p], uint[%d: %d+%d*%d]\n",
+ __PRETTY_FUNCTION__, aiKey, aiTotalSize, lpszShm, aiType, iNeedSize, aiUint, aiNum);
+ }
+ else
+ {
+ INFO_LOG("%s key[%d], size[%d] , mod[resume], address[%p], uint[%d: %d+%d*%d]\n",
+ __PRETTY_FUNCTION__, aiKey, aiTotalSize, lpszShm, aiType, iNeedSize, aiUint, aiNum);
+ }
+
+ //int liTotalSize = 0;
+ //< 数据结构: 包头 + 空闲数组 + 标示是否使用数组+实际对象空间。
+ //liTotalSize = sizeof(OBJPOOLHEAD) + sizeof(int)*m_pHead->iNum + sizeof(char)*m_pHead->iNum + m_pHead->iUint * m_pHead->iNum;
+ return iNeedSize;
+}
+
+template
+ENMShmStartMode CShmObjPool::GetStartFlag()
+{
+ CShmem loShmem;
+ return loShmem.GetStartFlag(m_pHead->iKey, m_pHead->iSize);
+}
+
+
+template
+void CShmObjPool::PrintHead(int aiFlag)
+{
+ printf("ShmHead key:%d size:%d num:%d type:%d uint:%d usenum:%d fhead:%d ftail:%d\n", m_pHead->iKey, m_pHead->iSize, m_pHead->iNum, \
+ m_pHead->iType, m_pHead->iUint, m_pHead->iUseNum, m_pHead->iFreeHead, m_pHead->iFreeTail);
+
+ if (aiFlag != 0)
+ {
+ printf("[i,FreeArray,UsedArray] num=%d\n", m_pHead->iNum);
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ printf("[%d,%d,%d]", i, m_pHead->piFreeArray[i], m_pHead->pcUsedArray[i]);
+ }
+ }
+ printf("\nEnd\n");
+}
+
+//适用于反复利用同一个节点
+template
+T* CShmObjPool::ForceGetObj(const int aiIndex, const int aiType)
+{
+ m_iErrCode = 0;
+
+ if (m_pHead->iType != aiType)
+ {
+ m_iErrCode = -1;
+ return NULL;
+ }
+ if (aiIndex >= m_pHead->iNum || aiIndex < 0)
+ {
+ m_iErrCode = -2;
+ return NULL;
+ }
+
+ return &(m_pObjHead[aiIndex]);
+}
+
+
+template
+T* CShmObjPool::GetFreeObj(const int aiType, int* aiIndex)
+{
+ if (m_pHead->iType != aiType)
+ {
+ *aiIndex = -1;
+ return NULL;
+ }
+
+ if (m_pHead->iUseNum == m_pHead->iNum)
+ {
+ *aiIndex = -2;
+ return NULL;
+ }
+ //< 获取空闲对象空间。
+ int liFreeHead = (m_pHead->iFreeHead + 1) % m_pHead->iNum;
+ if (liFreeHead == m_pHead->iFreeTail)
+ {
+ //< full. no free node.
+ *aiIndex = -3;
+ return NULL;
+ }
+
+ *aiIndex = m_pHead->piFreeArray[liFreeHead];
+ m_pHead->iFreeHead = liFreeHead;
+
+ m_pHead->pcUsedArray[*aiIndex] = 1;
+ m_pHead->iUseNum++;
+
+ T* lpoObj = &(m_pObjHead[*aiIndex]);
+ lpoObj->Init();
+
+ return lpoObj;
+}
+
+template
+int CShmObjPool::FreeObj(const int aiType, const int aiIndex)
+{
+ if (m_pHead->iType != aiType)
+ return -1;
+
+ if (aiIndex >= m_pHead->iNum || aiIndex < 0)
+ return -2;
+
+ /// 回收对象空间。
+ if (m_pHead->iFreeHead == m_pHead->iFreeTail)
+ {
+ return -3;
+ }
+
+ if (m_pHead->pcUsedArray[aiIndex] != 1)
+ return -4;
+
+ /// 注意顺序,需要先调用对象的函数,然后放入空闲队列
+ T* lpo = &(m_pObjHead[aiIndex]);
+ lpo->Reclaim();
+
+ m_pHead->piFreeArray[m_pHead->iFreeTail] = aiIndex;
+ m_pHead->iFreeTail = (m_pHead->iFreeTail + 1) % m_pHead->iNum;
+
+ m_pHead->pcUsedArray[aiIndex] = 0;
+
+ m_pHead->iUseNum--;
+
+ return 0;
+}
+
+template
+int CShmObjPool::ProcessAllObj(int (*ProcessObj)(T*))
+{
+ int liRet = 0;
+ /// 处理已经分配出去的节点。
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ if (0 == m_pHead->pcUsedArray[i])
+ continue;
+
+ /// process.已经分配出去,处理。
+ liRet = ProcessObj(&(m_pObjHead[i]));
+ if (100 == liRet)
+ {
+ /// 回收对象。
+ liRet = FreeObj(m_pHead->iType, i);
+ }
+ // 终止遍历
+ else if (2120 == liRet)
+ {
+ break;
+ }
+ }
+
+ return liRet;
+}
+
+
+//使遍历每个节点的函数可以接受其他参数
+//参数意义:
+//ProcessObj:对应的处理函数
+//pArg:需要传入的其他参数,可以是结构体类型指针
+//iLen: 传入的void*指针对应的内存长度
+//iType: 操作类型
+template
+int CShmObjPool::ProcessAllObj(int (*ProcessObj)(T*, void*, int, int), void* pArg, int iLen, int iType)
+{
+ int liRet = 0;
+ /// 处理已经分配出去的节点。
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ if (0 == m_pHead->pcUsedArray[i])
+ continue;
+
+ /// process.已经分配出去,处理。
+ liRet = ProcessObj(&(m_pObjHead[i]), pArg, iLen, iType);
+ if (100 == liRet)
+ {
+ /// 回收对象。
+ liRet = FreeObj(m_pHead->iType, i);
+ }
+ }
+
+ return liRet;
+}
+
+//使遍历每个节点的函数可以接受其他参数
+//参数意义:
+//ProcessObj:对应的处理函数
+//pArg:需要传入的其他参数,可以是结构体类型指针
+//iLen: 传入的void*指针对应的内存长度
+//iType: 操作类型
+//iStartIdx: 从StartIdx开始遍历
+template
+int CShmObjPool::ProcessAllObj(int (*ProcessObj)(T*, void*, int, int), void* pArg, int iLen, int iType, int iStartIdx)
+{
+ int liRet = 0;
+ /// 处理已经分配出去的节点。
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ int idx = (i + iStartIdx) % m_pHead->iNum;
+
+ if (0 == m_pHead->pcUsedArray[idx])
+ continue;
+
+ /// process.已经分配出去,处理。
+ liRet = ProcessObj(&(m_pObjHead[idx]), pArg, iLen, iType);
+ if (100 == liRet)
+ {
+ /// 回收对象。
+ liRet = FreeObj(m_pHead->iType, idx);
+ }
+
+ if (200 == liRet)
+ {
+ break;
+ }
+ }
+
+ return liRet;
+}
+
+template
+bool CShmObjPool::CheckShm()
+{
+ T* lpoObj = NULL;
+
+ for (int i = 0; i < m_pHead->iNum; i++)
+ {
+ lpoObj = (T*)&(m_pObjHead[i]);
+ if (!lpoObj->CheckMem())
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+#endif
+
diff --git a/linuxserverplatform/src/include/ServerCommon/shmem.h b/linuxserverplatform/src/include/ServerCommon/shmem.h
new file mode 100644
index 0000000..622553c
--- /dev/null
+++ b/linuxserverplatform/src/include/ServerCommon/shmem.h
@@ -0,0 +1,74 @@
+#ifndef _SHMEM_H_
+#define _SHMEM_H_
+
+#include
+
+typedef struct ShmRecordNode
+{
+ int iIdx;
+ int iShmKey;
+ unsigned int dwTotalSize;
+ unsigned int dwNeedSize;
+}tagShmRecordNode;
+
+typedef std::vector ShmRecordInfoVec;
+
+
+//共享内存启动模式
+enum ENMShmStartMode
+{
+ ESSM_Init = 1, //全新,即原来没有共享内存新创建
+ ESSM_Resume = 2, //恢复,即共享原来已经存在,恢复使用
+};
+
+#define MAX_KEY_TO_ADDRESS_NUM 50 //最大共享内存块个数
+
+//共享内存到进程空间地址的映射
+struct STShmKeyToAddress
+{
+ int m_iKey; //标识key
+ int m_iSize; //共享内存大小
+ ENMShmStartMode m_enmStartMode; //启动模式
+ void* m_vpMemAddr; //对应的地址
+ unsigned int m_uiOffset; //当前已分配的偏移
+ int m_iCount; //申请共享内存次数统计
+};
+
+class CShmem
+{
+
+public:
+ CShmem();
+ ~CShmem();
+
+ void* CreateShmem(const int aiKey, const unsigned int aiTotalSize, const unsigned int aiNeedSize, const char* pFile, int iLine, int aiMode = 0666);
+
+ int DestroyShmem(const int aiKey, const unsigned int aiTotalSize);
+
+ ENMShmStartMode GetStartFlag(const int aiKey, const int aiTotalSize);
+
+ static void RecordShmInfo(int iShmKey, unsigned int dwTotalSize, unsigned int dwNeedSize);
+ static void LogShmInfo();
+
+private:
+
+ //通过共享内存的key和大小获得其进程空间指针
+ static STShmKeyToAddress* FindAddrOfKey(const int aiKey, const int aiTotalSize);
+ //增加一个共享内存的key和大小与其进程空间指针的对应关系
+ static int AddOneKeyToAddress(STShmKeyToAddress& stKeyToAddr);
+ //删除一个共享内存的key和大小与其进程空间指针的对应关系
+ static int DelOneKeyToAddress(const int aiKey, const int aiTotalSize);
+
+private:
+
+ static int ms_iKeyToAddrNum; //当前已经存在的共享内存个数
+ static STShmKeyToAddress ms_stKeyToAddr[MAX_KEY_TO_ADDRESS_NUM]; //共享内存到地址数组
+
+ static ShmRecordInfoVec m_ShmRecordInfoVec;
+ static bool m_bShmRecordInfoVecInit;
+
+};
+
+
+#endif
+
diff --git a/linuxserverplatform/src/test/Makefile b/linuxserverplatform/src/test/Makefile
index 0548ab7..79279c1 100644
--- a/linuxserverplatform/src/test/Makefile
+++ b/linuxserverplatform/src/test/Makefile
@@ -8,7 +8,7 @@ LIBS = -lKernel -lCommon -lprotobuf -ljson -lpthread -levent -ljemalloc
BINDIR := ../bin/
BIN := test
-OBJ := jemalloc_cpp.o test.pb.o main.o
+OBJ := jemalloc_cpp.o test.pb.o main.o Shm.o
$(BINDIR)$(BIN):$(OBJ)
$(CPP) -o $@ $(LDFLAGS) $^ $(LIBS)
diff --git a/linuxserverplatform/src/test/Shm.cpp b/linuxserverplatform/src/test/Shm.cpp
new file mode 100644
index 0000000..a20cf40
--- /dev/null
+++ b/linuxserverplatform/src/test/Shm.cpp
@@ -0,0 +1,120 @@
+#include "CommonHead.h"
+#include "shm_obj_pool.h"
+
+class A
+{
+public:
+ A() {}
+ ~A() {}
+ bool CheckMem() { return true; }
+ void Init() { /*printf("第一次使用对象内存\n");*/ }
+ void Resume() { /*printf("恢复对象内存\n");*/ }
+ static A* CreateObject(void* p)
+ {
+ A* pa = (A*)p;
+
+
+ printf("val = %d\n", pa->val);
+
+
+ return pa;
+ }
+ void Reclaim()
+ {
+ val = 0;
+ printf("回收对象内存\n");
+ }
+ int val;
+};
+
+const int a_size = 4;
+
+int TestShm()
+{
+
+ int index = 0;
+ A* p = NULL;
+ CShmObjPool myobj;
+
+ srand((unsigned int)time(0));
+
+ myobj.CreateObjPool(1234, 1234, sizeof(A), a_size, 0, __FILE__, __LINE__);
+
+ ENMShmStartMode starttype = myobj.GetStartFlag();
+ if (starttype == ESSM_Resume)
+ {
+ printf("恢复内存\n");
+ }
+ else
+ {
+ printf("第一次使用内存\n");
+ }
+
+
+ /* for (int i = 0; i < 4; i++)
+ {
+ myobj.FreeObj(0, i);
+ }
+
+ printf("剩余数量:%d\n", myobj.GetUseNum());
+ for (int i = 0; i < a_size; i++)
+ {
+ A* pa = myobj.GetObj(i, 0);
+ if (pa)
+ {
+ printf("%d\n", pa->val);
+ }
+ else
+ {
+ printf("0\n");
+ }
+
+ }*/
+
+ int iCount = rand() % 2 + 2;
+ for (int i = 0; i < iCount; i++)
+ {
+ p = myobj.GetFreeObj(0, &index);
+ if (p)
+ {
+ if (p->val != 0)
+ {
+ printf("===========出错=======\n");
+ }
+ p->val = rand();
+ }
+ }
+
+
+ printf("使用数量:%d\n", myobj.GetUseNum());
+ for (int i = 0; i < a_size; i++)
+ {
+ A* pa = myobj.GetObj(i, 0);
+ if (pa)
+ {
+ printf("%d\n", pa->val);
+ }
+ else
+ {
+ printf("0\n");
+ }
+ }
+
+ /* for (int i = 0; i < a_size;i++)
+ {
+ int index = -1;
+ A* p = myobj.GetFreeObj(0, &index);
+ if (p == NULL)
+ {
+ printf("共享内存分配完毕\n");
+ }
+ else
+ {
+ p->val = 125;
+ }
+ }*/
+
+
+ printf("hello from TestShm!\n");
+ return 0;
+}
\ No newline at end of file
diff --git a/linuxserverplatform/src/test/main.cpp b/linuxserverplatform/src/test/main.cpp
index a1e19de..f53feba 100644
--- a/linuxserverplatform/src/test/main.cpp
+++ b/linuxserverplatform/src/test/main.cpp
@@ -169,8 +169,40 @@ class A
printf("A\n");
}
};
+
+extern int TestShm();
+
int main(int argc, char** argv)
{
+ // 设置程序路径 , 创建日志目录
+ CINIFile file(CINIFile::GetAppPath() + "config.ini");
+ string logPath = file.GetKeyVal("COMMON", "logPath", "./log/");
+ if (!CUtil::MkdirIfNotExists(logPath.c_str()))
+ {
+ printf("创建日志目录失败!!! err=%s", strerror(errno));
+ return -1;
+ }
+ GameLogManage()->SetLogPath(logPath);
+
+ // 设置服务器类型
+ ConfigManage()->SetServiceType(SERVICE_TYPE_LOADER);
+
+ // 关联大厅主线程的log文件
+ GameLogManage()->AddLogFile(GetCurrentThreadId(), THREAD_TYPE_MAIN);
+
+ bool ret = false;
+
+ // 加载基础配置
+ ret = ConfigManage()->Init();
+ if (!ret)
+ {
+ CON_ERROR_LOG("ConfigManage::Init error! 请查看启动日志 !!!");
+ return -1;
+ }
+
+ TestShm();
+
+
// 测试http服务器
CHttpServer httpserver;
httpserver.Start();
diff --git a/linuxserverplatform/test/test.vcxproj b/linuxserverplatform/test/test.vcxproj
index 0b9a0be..b7f662a 100644
--- a/linuxserverplatform/test/test.vcxproj
+++ b/linuxserverplatform/test/test.vcxproj
@@ -110,13 +110,14 @@
+
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -131,7 +132,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -144,7 +145,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -159,7 +160,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -172,7 +173,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -187,7 +188,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -200,7 +201,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon
@@ -215,7 +216,7 @@
- /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;%(AdditionalIncludeDirectories)
+ /usr/local/include/curl;/usr/local/include/DataBase;/usr/local/include/libevent;/usr/local/include/hiredis;/usr/local/include;$(RemoteRootDir)/Kernel/src/include/ServerCommon;$(RemoteRootDir)/Common/src/include/ServerCommon;$(RemoteRootDir)/Common/src/protobuf;$(RemoteRootDir)/GameManage/src/include/ServerCommon;$(RemoteRootDir)/test/src/protobuf;../src/include/ServerCommon