Skip to content

Commit 6af41f7

Browse files
committed
added:center protocol and add file with manage interface
1 parent 9260fea commit 6af41f7

File tree

15 files changed

+178
-29
lines changed

15 files changed

+178
-29
lines changed

XEngine_Source/XEngine_StorageApp/StorageApp_Center.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ BOOL XEngine_Task_HttpCenter(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int
111111
{
112112
XEngine_Task_Event(tszAPIName, lpszClientAddr, lpszMsgBuffer, nMsgLen, pSt_HTTPParam, pptszListHdr, nHdrCount);
113113
}
114+
else if (0 == _tcsnicmp(XENGINE_STORAGE_APP_TASK_MANAGE, tszAPIMethod, _tcslen(XENGINE_STORAGE_APP_TASK_MANAGE)))
115+
{
116+
XEngine_Task_Manage(tszAPIName, lpszClientAddr, lpszMsgBuffer, nMsgLen, pSt_HTTPParam, pptszListHdr, nHdrCount);
117+
}
114118
}
115119
else if (0 == _tcsnicmp(lpszMethodGet, pSt_HTTPParam->tszHttpMethod, _tcslen(lpszMethodGet)))
116120
{
@@ -122,7 +126,7 @@ BOOL XEngine_Task_HttpCenter(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int
122126
{
123127
st_HDRParam.bAuth = TRUE;
124128
}
125-
XEngine_Task_P2p(pSt_HTTPParam->tszHttpUri + 1, lpszClientAddr, pSt_HTTPParam);
129+
XEngine_Task_P2PGet(pSt_HTTPParam->tszHttpUri + 1, lpszClientAddr, pSt_HTTPParam);
126130
}
127131
else
128132
{

XEngine_Source/XEngine_StorageApp/StorageApp_Center.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
#define XENGINE_STORAGE_APP_TASK_EVENT _T("Event")
44
#define XENGINE_STORAGE_APP_TASK_QUERY _T("Query")
55
#define XENGINE_STORAGE_APP_TASK_PASS _T("Pass")
6+
#define XENGINE_STORAGE_APP_TASK_MANAGE _T("Manage")
67

78
#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")
12+
#define XENGINE_STORAGE_APP_METHOD_ADD _T("Add")
13+
#define XENGINE_STORAGE_APP_METHOD_DEL _T("Del")
1114

1215
XHTHREAD CALLBACK XEngine_Center_HTTPThread(LPVOID lParam);
1316
BOOL XEngine_Task_HttpCenter_APIList(LPCTSTR lpszUrlName, TCHAR* ptszAPIVersion, TCHAR* ptszAPIMethod, TCHAR* ptszAPIName);

XEngine_Source/XEngine_StorageApp/StorageApp_Download.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,32 +86,6 @@ XHTHREAD CALLBACK XEngine_Download_SendThread(LPVOID lParam)
8686
APIHelp_HttpRequest_Post(st_ServiceCfg.st_XProxy.st_XProxyPass.tszDLPass, tszProxyStr, &nHttpCode);
8787
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE, _T("下载客户端:%s,请求完成通知返回值:%d,文件:%s,地址:%s"), tszClientAddr, nHttpCode, st_StorageInfo.tszFileDir, st_ServiceCfg.st_XProxy.st_XProxyPass.tszDLPass);
8888
}
89-
//如果启用了数据库并且启用了P2P存储网络
90-
if ((0 != st_ServiceCfg.st_XSql.nSQLType) && (st_ServiceCfg.st_P2xp.nMode > 0))
91-
{
92-
UCHAR tszHashKey[MAX_PATH];
93-
XSTORAGECORE_DBFILE st_DBFile;
94-
SESSION_STORAGEINFO st_StorageInfo;
95-
96-
memset(tszHashKey, '\0', MAX_PATH);
97-
memset(&st_DBFile, '\0', sizeof(XSTORAGECORE_DBFILE));
98-
memset(&st_StorageInfo, '\0', sizeof(SESSION_STORAGEINFO));
99-
100-
Session_DLStroage_GetInfo(nThreadPos, i, &st_StorageInfo);
101-
102-
st_DBFile.st_ProtocolFile.nFileSize = st_StorageInfo.ullCount;
103-
OPenSsl_Api_Digest(st_StorageInfo.tszFileDir, tszHashKey, NULL, TRUE, st_ServiceCfg.st_XStorage.nHashMode);
104-
BaseLib_OperatorString_StrToHex((char*)tszHashKey, 20, st_DBFile.st_ProtocolFile.tszFileHash);
105-
BaseLib_OperatorString_GetFileAndPath(st_StorageInfo.tszFileDir, st_DBFile.st_ProtocolFile.tszFilePath, st_DBFile.st_ProtocolFile.tszFileName);
106-
if (1 == st_ServiceCfg.st_XSql.nSQLType)
107-
{
108-
XStorageSQL_File_FileInsert(&st_DBFile);
109-
}
110-
else
111-
{
112-
XStorage_SQLite_FileInsert(&st_DBFile);
113-
}
114-
}
11589
Session_DLStroage_Delete(tszClientAddr);
11690
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE, _T("下载客户端:%s,文件已经发送完毕,用户已经被移除发送列表"), tszClientAddr);
11791
continue;

XEngine_Source/XEngine_StorageApp/StorageApp_Hdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ extern XENGINE_LBCONFIG st_LoadbalanceCfg;
105105
#include "Storage_APPTask/Storage_TaskPass.h"
106106
#include "Storage_APPTask/Storage_TaskQuery.h"
107107
#include "Storage_APPTask/Storage_TaskP2p.h"
108+
#include "Storage_APPTask/Storage_TaskManage.h"
108109
#include "Storage_APPHelp/Storage_APPHelp.h"
109110

110111
#ifdef _WINDOWS
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "../StorageApp_Hdr.h"
2+
3+
4+
BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, TCHAR** pptszListHdr, int nHdrCount)
5+
{
6+
int nSDLen = 2048;
7+
TCHAR tszSDBuffer[2048];
8+
RFCCOMPONENTS_HTTP_HDRPARAM st_HDRParam;
9+
10+
memset(tszSDBuffer, '\0', sizeof(tszSDBuffer));
11+
memset(&st_HDRParam, '\0', sizeof(RFCCOMPONENTS_HTTP_HDRPARAM));
12+
13+
//文件存储成功的事件上传
14+
if (0 == _tcsnicmp(XENGINE_STORAGE_APP_METHOD_ADD, lpszAPIName, _tcslen(XENGINE_STORAGE_APP_METHOD_ADD)))
15+
{
16+
int nListCount = 0;
17+
XSTORAGECORE_DBFILE** ppSt_DBFile;
18+
19+
XStorageProtocol_Core_ReportFileParse(lpszMsgBuffer, nMsgLen, &ppSt_DBFile, &nListCount);
20+
for (int i = 0; i < nListCount; i++)
21+
{
22+
if (0 == ppSt_DBFile[i]->st_ProtocolFile.nFileSize)
23+
{
24+
TCHAR tszFileDir[MAX_PATH];
25+
_stprintf(tszFileDir, _T("%s %s"), ppSt_DBFile[i]->st_ProtocolFile.tszFilePath, ppSt_DBFile[i]->st_ProtocolFile.tszFileName);
26+
XStorageSQL_File_FileInsert(ppSt_DBFile[i]);
27+
}
28+
}
29+
st_HDRParam.nHttpCode = 200;
30+
RfcComponents_HttpServer_SendMsgEx(xhUPHttp, tszSDBuffer, &nSDLen, &st_HDRParam);
31+
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPCENTER);
32+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("业务客户端:%s"), lpszClientAddr);
33+
}
34+
return TRUE;
35+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, TCHAR** pptszListHdr, int nHdrCount);

XEngine_Source/XEngine_StorageApp/Storage_APPTask/Storage_TaskP2p.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ XHTHREAD XEngine_Task_P2PThread()
5555
}
5656
return 0;
5757
}
58-
BOOL XEngine_Task_P2p(LPCTSTR lpszFileHash, LPCTSTR lpszClientAddr, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam)
58+
BOOL XEngine_Task_P2PGet(LPCTSTR lpszFileHash, LPCTSTR lpszClientAddr, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam)
5959
{
6060
int nSDLen = 2048;
6161
int nRVLen = 2048;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#pragma once
22

33
XHTHREAD XEngine_Task_P2PThread();
4-
BOOL XEngine_Task_P2p(LPCTSTR lpszFileHash, LPCTSTR lpszClientAddr, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam);
4+
BOOL XEngine_Task_P2PGet(LPCTSTR lpszFileHash, LPCTSTR lpszClientAddr, RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam);

XEngine_Source/XEngine_StorageApp/XEngine_StorageApp.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
<ClCompile Include="StorageApp_UPLoader.cpp" />
158158
<ClCompile Include="Storage_APPHelp\Storage_APPHelp.cpp" />
159159
<ClCompile Include="Storage_APPTask\Storage_TaskEvent.cpp" />
160+
<ClCompile Include="Storage_APPTask\Storage_TaskManage.cpp" />
160161
<ClCompile Include="Storage_APPTask\Storage_TaskP2p.cpp" />
161162
<ClCompile Include="Storage_APPTask\Storage_TaskPass.cpp" />
162163
<ClCompile Include="Storage_APPTask\Storage_TaskQuery.cpp" />
@@ -173,6 +174,7 @@
173174
<ClInclude Include="StorageApp_UPLoader.h" />
174175
<ClInclude Include="Storage_APPHelp\Storage_APPHelp.h" />
175176
<ClInclude Include="Storage_APPTask\Storage_TaskEvent.h" />
177+
<ClInclude Include="Storage_APPTask\Storage_TaskManage.h" />
176178
<ClInclude Include="Storage_APPTask\Storage_TaskP2p.h" />
177179
<ClInclude Include="Storage_APPTask\Storage_TaskPass.h" />
178180
<ClInclude Include="Storage_APPTask\Storage_TaskQuery.h" />

XEngine_Source/XEngine_StorageApp/XEngine_StorageApp.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<ClCompile Include="Storage_APPTask\Storage_TaskP2p.cpp">
6464
<Filter>源文件\Storage_APPTask</Filter>
6565
</ClCompile>
66+
<ClCompile Include="Storage_APPTask\Storage_TaskManage.cpp">
67+
<Filter>源文件\Storage_APPTask</Filter>
68+
</ClCompile>
6669
</ItemGroup>
6770
<ItemGroup>
6871
<ClInclude Include="StorageApp_Config.h">
@@ -101,5 +104,8 @@
101104
<ClInclude Include="Storage_APPTask\Storage_TaskP2p.h">
102105
<Filter>头文件\Storage_APPTask</Filter>
103106
</ClInclude>
107+
<ClInclude Include="Storage_APPTask\Storage_TaskManage.h">
108+
<Filter>头文件\Storage_APPTask</Filter>
109+
</ClInclude>
104110
</ItemGroup>
105111
</Project>

0 commit comments

Comments
 (0)