Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XEngine
XEngine Authorize
提交
9b1a2fc5
X
XEngine Authorize
项目概览
XEngine
/
XEngine Authorize
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
XEngine Authorize
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9b1a2fc5
编写于
10月 13, 2021
作者:
xengine-qyt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support:websocket and tcp service
上级
14d89a43
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
69 addition
and
23 deletion
+69
-23
XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp
...ice/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp
+59
-21
XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj
...XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj
+4
-2
XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters
...AuthorizeService/XEngine_AuthorizeService.vcxproj.filters
+6
-0
未找到文件。
XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp
浏览文件 @
9b1a2fc5
...
...
@@ -2,9 +2,12 @@
BOOL
bIsRun
=
FALSE
;
XLOG
xhLog
=
NULL
;
XNETHANDLE
xhSocket
=
0
;
XNETHANDLE
xhPacket
=
0
;
XNETHANDLE
xhPool
=
0
;
XNETHANDLE
xhTCPSocket
=
0
;
XNETHANDLE
xhWSSocket
=
0
;
XNETHANDLE
xhTCPPacket
=
0
;
XHANDLE
xhWSPacket
=
NULL
;
XNETHANDLE
xhTCPPool
=
0
;
XNETHANDLE
xhWSPool
=
0
;
AUTHORIZE_CONFIGURE
st_AuthConfig
;
void
ServiceApp_Stop
(
int
signo
)
...
...
@@ -14,9 +17,12 @@ void ServiceApp_Stop(int signo)
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN
,
_T
(
"网络验证服务器退出..."
));
bIsRun
=
FALSE
;
HelpComponents_Datas_Destory
(
xhPacket
);
NetCore_TCPXCore_DestroyEx
(
xhSocket
);
ManagePool_Thread_NQDestroy
(
xhPool
);
HelpComponents_Datas_Destory
(
xhTCPPacket
);
RfcComponents_WSPacket_DestoryEx
(
xhWSPacket
);
NetCore_TCPXCore_DestroyEx
(
xhTCPSocket
);
NetCore_TCPXCore_DestroyEx
(
xhWSSocket
);
ManagePool_Thread_NQDestroy
(
xhTCPPool
);
ManagePool_Thread_NQDestroy
(
xhWSPool
);
HelpComponents_XLog_Destroy
(
xhLog
);
AuthService_Session_Destroy
();
...
...
@@ -63,7 +69,8 @@ int main(int argc, char** argv)
#endif
bIsRun
=
TRUE
;
HELPCOMPONENTS_XLOG_CONFIGURE
st_XLogConfig
;
THREADPOOL_PARAMENT
**
ppSt_ListThread
;
THREADPOOL_PARAMENT
**
ppSt_ListTCPThread
;
THREADPOOL_PARAMENT
**
ppSt_ListWSThread
;
memset
(
&
st_XLogConfig
,
'\0'
,
sizeof
(
HELPCOMPONENTS_XLOG_CONFIGURE
));
memset
(
&
st_AuthConfig
,
'\0'
,
sizeof
(
AUTHORIZE_CONFIGURE
));
...
...
@@ -110,35 +117,63 @@ int main(int argc, char** argv)
}
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化会话服务成功"
));
if
(
!
HelpComponents_Datas_Init
(
&
xhPacket
,
10000
,
0
,
st_AuthConfig
.
nThreads
))
if
(
!
HelpComponents_Datas_Init
(
&
xh
TCP
Packet
,
10000
,
0
,
st_AuthConfig
.
nThreads
))
{
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR
,
_T
(
"启动服务中,初始化组包器失败,错误:%lX"
),
Packets_GetLastError
());
goto
XENGINE_EXITAPP
;
}
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化组包器成功,句柄:%llu,任务池个数:%d"
),
xhPacket
,
st_AuthConfig
.
nThreads
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化组包器成功,句柄:%llu,任务池个数:%d"
),
xh
TCP
Packet
,
st_AuthConfig
.
nThreads
);
if
(
!
NetCore_TCPXCore_StartEx
(
&
xhSocket
,
st_AuthConfig
.
nPort
,
10000
,
st_AuthConfig
.
nThreads
))
xhWSPacket
=
RfcComponents_WSPacket_InitEx
(
10000
,
TRUE
,
st_AuthConfig
.
nThreads
);
if
(
NULL
==
xhWSPacket
)
{
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR
,
_T
(
"启动服务中,初始化WebSocket协议管理器失败,错误:%lX"
),
WSFrame_GetLastError
());
goto
XENGINE_EXITAPP
;
}
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化WebSocket协议管理器成功,句柄:%llu,任务池个数:%d"
),
xhWSPacket
,
st_AuthConfig
.
nThreads
);
if
(
!
NetCore_TCPXCore_StartEx
(
&
xhTCPSocket
,
st_AuthConfig
.
nTCPPort
,
10000
,
st_AuthConfig
.
nThreads
))
{
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR
,
_T
(
"启动服务中,启动验证网络服务失败,错误:%lX"
),
NetCore_GetLastError
());
goto
XENGINE_EXITAPP
;
}
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化验证网络服务成功,句柄:%llu,端口:%d,网络池个数:%d"
),
xhTCPSocket
,
st_AuthConfig
.
nTCPPort
,
st_AuthConfig
.
nThreads
);
NetCore_TCPXCore_RegisterCallBackEx
(
xhTCPSocket
,
XEngine_Client_TCPAccept
,
XEngine_Client_TCPRecv
,
XEngine_Client_TCPClose
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化验证网络事件成功"
));
if
(
!
NetCore_TCPXCore_StartEx
(
&
xhWSSocket
,
st_AuthConfig
.
nWSPort
,
10000
,
st_AuthConfig
.
nThreads
))
{
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR
,
_T
(
"启动服务中,启动验证网络服务失败,错误:%lX"
),
NetCore_GetLastError
());
goto
XENGINE_EXITAPP
;
}
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化验证网络服务成功,句柄:%llu,端口:%d,网络池个数:%d"
),
xh
Socket
,
st_AuthConfig
.
n
Port
,
st_AuthConfig
.
nThreads
);
NetCore_TCPXCore_RegisterCallBackEx
(
xh
Socket
,
XEngine_Client_Accept
,
XEngine_Client_Recv
,
XEngine_Client_
Close
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化验证网络服务成功,句柄:%llu,端口:%d,网络池个数:%d"
),
xh
WSSocket
,
st_AuthConfig
.
nWS
Port
,
st_AuthConfig
.
nThreads
);
NetCore_TCPXCore_RegisterCallBackEx
(
xh
WSSocket
,
XEngine_Client_WSAccept
,
XEngine_Client_WSRecv
,
XEngine_Client_WS
Close
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,初始化验证网络事件成功"
));
BaseLib_OperatorMemory_Malloc
((
XPPPMEM
)
&
ppSt_ListThread
,
st_AuthConfig
.
nThreads
,
sizeof
(
THREADPOOL_PARAMENT
));
BaseLib_OperatorMemory_Malloc
((
XPPPMEM
)
&
ppSt_ListTCPThread
,
st_AuthConfig
.
nThreads
,
sizeof
(
THREADPOOL_PARAMENT
));
for
(
int
i
=
0
;
i
<
st_AuthConfig
.
nThreads
;
i
++
)
{
XENGINE_THREADINFO
*
pSt_AuthThread
=
new
XENGINE_THREADINFO
;
pSt_AuthThread
->
nPoolIndex
=
i
;
ppSt_ListTCPThread
[
i
]
->
lParam
=
pSt_AuthThread
;
ppSt_ListTCPThread
[
i
]
->
fpCall_ThreadsTask
=
XEngine_AuthService_TCPThread
;
}
ManagePool_Thread_NQCreate
(
&
xhTCPPool
,
&
ppSt_ListTCPThread
,
st_AuthConfig
.
nThreads
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,启动TCP任务线程池成功,线程个数:%d"
),
st_AuthConfig
.
nThreads
);
BaseLib_OperatorMemory_Malloc
((
XPPPMEM
)
&
ppSt_ListWSThread
,
st_AuthConfig
.
nThreads
,
sizeof
(
THREADPOOL_PARAMENT
));
for
(
int
i
=
0
;
i
<
st_AuthConfig
.
nThreads
;
i
++
)
{
XENGINE_THREADINFO
*
pSt_AuthThread
=
new
XENGINE_THREADINFO
;
pSt_AuthThread
->
nPoolIndex
=
i
;
ppSt_ListThread
[
i
]
->
lParam
=
pSt_AuthThread
;
ppSt_List
Thread
[
i
]
->
fpCall_ThreadsTask
=
XEngine_AuthService_TCP
Thread
;
ppSt_List
WS
Thread
[
i
]
->
lParam
=
pSt_AuthThread
;
ppSt_List
WSThread
[
i
]
->
fpCall_ThreadsTask
=
XEngine_AuthService_WS
Thread
;
}
ManagePool_Thread_NQCreate
(
&
xh
Pool
,
&
ppSt_List
Thread
,
st_AuthConfig
.
nThreads
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,启动线程池成功,线程个数:%d"
),
st_AuthConfig
.
nThreads
);
ManagePool_Thread_NQCreate
(
&
xh
WSPool
,
&
ppSt_ListWS
Thread
,
st_AuthConfig
.
nThreads
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"启动服务中,启动
WEBSOCKET任务
线程池成功,线程个数:%d"
),
st_AuthConfig
.
nThreads
);
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"所有服务成功启动,网络验证服务运行中,当前运行版本:2.
2
.0.1001。。。"
));
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO
,
_T
(
"所有服务成功启动,网络验证服务运行中,当前运行版本:2.
3
.0.1001。。。"
));
while
(
bIsRun
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
...
...
@@ -151,9 +186,12 @@ XENGINE_EXITAPP:
XLOG_PRINT
(
xhLog
,
XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN
,
_T
(
"网络验证服务器退出..."
));
bIsRun
=
FALSE
;
HelpComponents_Datas_Destory
(
xhPacket
);
NetCore_TCPXCore_DestroyEx
(
xhSocket
);
ManagePool_Thread_NQDestroy
(
xhPool
);
HelpComponents_Datas_Destory
(
xhTCPPacket
);
RfcComponents_WSPacket_DestoryEx
(
xhWSPacket
);
NetCore_TCPXCore_DestroyEx
(
xhTCPSocket
);
NetCore_TCPXCore_DestroyEx
(
xhWSSocket
);
ManagePool_Thread_NQDestroy
(
xhTCPPool
);
ManagePool_Thread_NQDestroy
(
xhWSPool
);
HelpComponents_XLog_Destroy
(
xhLog
);
AuthService_Session_Destroy
();
...
...
XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj
浏览文件 @
9b1a2fc5
...
...
@@ -73,12 +73,12 @@
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<LinkIncremental>
true
</LinkIncremental>
<IncludePath>
$(XEngine_Include);$(IncludePath)
</IncludePath>
<LibraryPath>
$(XEngine_Lib
rary
);$(LibraryPath)
</LibraryPath>
<LibraryPath>
$(XEngine_Lib
32
);$(LibraryPath)
</LibraryPath>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<LinkIncremental>
false
</LinkIncremental>
<IncludePath>
$(XEngine_Include);$(IncludePath)
</IncludePath>
<LibraryPath>
$(XEngine_Lib
rary
);$(LibraryPath)
</LibraryPath>
<LibraryPath>
$(XEngine_Lib
32
);$(LibraryPath)
</LibraryPath>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<LinkIncremental>
true
</LinkIncremental>
...
...
@@ -149,6 +149,7 @@
<ClCompile
Include=
"Authorize_Task.cpp"
/>
<ClCompile
Include=
"Authorize_Net.cpp"
/>
<ClCompile
Include=
"Authorize_TCPTask.cpp"
/>
<ClCompile
Include=
"Authorize_WSTask.cpp"
/>
<ClCompile
Include=
"XEngine_AuthorizeService.cpp"
/>
</ItemGroup>
<ItemGroup>
...
...
@@ -157,6 +158,7 @@
<ClInclude
Include=
"Authorize_Task.h"
/>
<ClInclude
Include=
"Authorize_Net.h"
/>
<ClInclude
Include=
"Authorize_TCPTask.h"
/>
<ClInclude
Include=
"Authorize_WSTask.h"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
...
...
XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters
浏览文件 @
9b1a2fc5
...
...
@@ -30,6 +30,9 @@
<ClCompile
Include=
"Authorize_TCPTask.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"Authorize_WSTask.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"Authorize_Config.h"
>
...
...
@@ -47,5 +50,8 @@
<ClInclude
Include=
"Authorize_TCPTask.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"Authorize_WSTask.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录