Skip to content

Commit e7f47fc

Browse files
committed
support:not restart and reload configure
1 parent f6ec853 commit e7f47fc

File tree

9 files changed

+47
-11
lines changed

9 files changed

+47
-11
lines changed

README.en.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ feature list:
1616
2. support http api notify of event and management api interface
1717
3. support http encrypt and cert data transimission(planning) \
1818
4. support mysql record infomation.
19-
5. support load banace(planning)
19+
5. support load banace
2020
6. supprot http auth
2121
7. support log and config
2222
8. supprot speeds contral
2323
9. supprot task start and end proxy forwarding
24-
10. support p2p,bt and many more(planning)
25-
11. support second pass
26-
12. support nginx upload module proxy_pass
27-
13. support upload and download Redirect
24+
10. support p2p
25+
11. bt(planning)
26+
12. data distributed(planning)
27+
13. support second pass
28+
14. support nginx upload module proxy_pass
29+
15. support upload and download Redirect
2830

2931
## install
3032

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ c c++ file storage service
1515
2. 支持HTTP API接口事件通知与管理
1616
3. 支持HTTP加密与证书(规划中)
1717
4. 采用MYSQL记录信息
18-
5. 支持分布式(规划中)
18+
5. 支持分布式
1919
6. 支持HTTP验证
2020
7. 支持详尽的日志和配置信息
2121
8. 支持传输速率控制
2222
9. 支持任务开始结束代理转发
23-
10. 支持P2P,BT,数据分发(规划中)
24-
11. 支持秒传
25-
12. 支持NGINX UPLOAD MODULE上传代理
26-
13. 支持上传和下载重定向
23+
10. 支持P2P
24+
11. BT(规划中)
25+
12. 数据分发(规划中)
26+
13. 支持秒传
27+
14. 支持NGINX UPLOAD MODULE上传代理
28+
15. 支持上传和下载重定向
2729

2830
## 安装教程
2931

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ typedef struct tag_XEngine_ServerConfig
2020
int nCenterPort;
2121
int nStorageDLPort;
2222
int nStorageUPPort;
23+
struct
24+
{
25+
BOOL bReload;
26+
}st_Memory;
2327
struct
2428
{
2529
int nMaxClient;

XEngine_Source/XEngine_StorageApp/StorageApp_Center.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define XENGINE_STORAGE_APP_TASK_PASS _T("Pass")
66
#define XENGINE_STORAGE_APP_TASK_P2P _T("P2P")
77

8+
#define XENGINE_STORAGE_APP_METHOD_CONFIG _T("Config")
89
#define XENGINE_STORAGE_APP_METHOD_UPFILE _T("UPFile")
910
#define XENGINE_STORAGE_APP_METHOD_DLFILE _T("DLFile")
1011
#define XENGINE_STORAGE_APP_METHOD_FILE _T("File")

XEngine_Source/XEngine_StorageApp/StorageApp_Config.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ BOOL StorageApp_Config_Parament(int argc,char **argv)
3737
{
3838
st_ServiceCfg.bDeamon = _ttoi(argv[i + 1]);
3939
}
40+
else if (0 == _tcscmp("-r", argv[i]))
41+
{
42+
st_ServiceCfg.st_Memory.bReload = TRUE;
43+
}
4044
}
4145

4246
return TRUE;
@@ -50,5 +54,6 @@ void StorageApp_Config_ParamentHelp()
5054
printf(_T("-v or -V:输出版本号\n"));
5155
printf(_T("-l:设置日志输出级别\n"));
5256
printf(_T("-d:1 启用守护进程,2不启用\n"));
57+
printf(_T("-r:无重启,重载配置文件\n"));
5358
printf(_T("--------------------------启动参数帮助结束--------------------------\n"));
5459
}

XEngine_Source/XEngine_StorageApp/Storage_APPTask/Storage_TaskEvent.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,13 @@ BOOL XEngine_Task_Event(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lps
9393
_trename(tszFileDir, tszFileTmp);
9494
}
9595
}
96+
else if (0 == _tcsnicmp(XENGINE_STORAGE_APP_METHOD_CONFIG, lpszAPIName, _tcslen(XENGINE_STORAGE_APP_METHOD_CONFIG)))
97+
{
98+
StorageApp_Config_Parament(0, NULL);
99+
st_HDRParam.nHttpCode = 200;
100+
RfcComponents_HttpServer_SendMsgEx(xhUPHttp, tszSDBuffer, &nSDLen, &st_HDRParam);
101+
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPCENTER);
102+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("业务客户端:%s,处理用户重载配置文件成功"), lpszClientAddr);
103+
}
96104
return TRUE;
97105
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#pragma once
22

3+
//数据库操作
34
BOOL XEngine_Task_Query(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, TCHAR** pptszListHdr, int nHdrCount);

XEngine_Source/XEngine_StorageApp/XEngine_StorageApp.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ int main(int argc, char** argv)
101101
{
102102
return -1;
103103
}
104+
if (st_ServiceCfg.st_Memory.bReload)
105+
{
106+
//重载配置文件后退出
107+
TCHAR tszAddr[128];
108+
memset(tszAddr, '\0', sizeof(tszAddr));
109+
110+
_stprintf(tszAddr, _T("Http://127.0.0.1:%d/Api/Event/Config"), st_ServiceCfg.nCenterPort);
111+
APIHelp_HttpRequest_Post(tszAddr);
112+
return 0;
113+
}
104114
st_XLogConfig.XLog_MaxBackupFile = st_ServiceCfg.st_XLog.nMaxCount;
105115
st_XLogConfig.XLog_MaxSize = st_ServiceCfg.st_XLog.nMaxSize;
106116
_tcscpy(st_XLogConfig.tszFileName, _T("./XEngine_XLog/XEngine_StorageApp.log"));
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup />
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
4+
<LocalDebuggerCommandArguments>-r</LocalDebuggerCommandArguments>
5+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6+
</PropertyGroup>
47
</Project>

0 commit comments

Comments
 (0)