Skip to content

Commit 6acb42f

Browse files
authored
Merge pull request #11 from libxengine/develop
V2.3版本合并
2 parents f2e58e1 + 85bc421 commit 6acb42f

28 files changed

+428
-72
lines changed

README.en.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ vcpkg integrate install
4949
you can not use vcpkg and config jsoncpp development for youself
5050

5151
##### XEngine
52-
XEngine can be download with mine repository,whe you downloaded xengine,you have to add value to you user environment
53-
- XEngine_Include header file path
54-
- XEngine_Library library file path
52+
download xengine through git.read xengine project readme file to configure your env
5553

5654
#### Linux
5755
Linux use Makefile to complie
@@ -66,7 +64,7 @@ sudo dnf install jsoncpp-devel
6664

6765
##### XEngine Install
6866
you can install xengine env to your system by shell
69-
like this:sudo XEngine_RunEnv.sh -i 3
67+
like this:sudo XEngine_LINEnv.sh -i 3
7068
##### complie
7169
execute command in XEngine_Source path
7270
make complie
@@ -87,7 +85,7 @@ The Second pass is not realized by the server, it is by the client
8785
upload file second pass is first check the HASH file is on the server, if has file on the server, it will directly prompt the upload is successful.
8886
The realization of downloading second transmission is to first query the local file save path through HASH, and download it directly if it exists.
8987

90-
## 关于P2P
88+
## about P2P
9189
P2P distributed download has been supported, but currently only in the lan,cross-network segment is not supported for the time being, you need to wait for the development to be completed
9290
P2P distributed download is the same as the hyper-threaded download of other download tools. The principle is to use the HTTP RANGE field. You can implement this function through libraries such as libcurl.
9391

@@ -99,7 +97,9 @@ P2P distributed download is the same as the hyper-threaded download of other dow
9997
- XEngine_SQLFile database sql file
10098

10199
## now task
102-
expand management interface
100+
P2P WAN file search and download support
101+
file send use system event
102+
Download speed limit optimization
103103

104104
## other problems
105105
You can refer to the document under the docment directory. It contains API protocol and service description.
@@ -111,6 +111,10 @@ You can refer to the document under the docment directory. It contains API proto
111111
3. Submit the code
112112
4. New Pull Request
113113

114+
## Clean up statement
115+
the software will not generate any files to other directories in your system.
116+
the software can achieve complete cleanup by directly delete the directory.
117+
114118
## Follow us
115119
If you think this software is helpful to you, please give us a START
116120

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ vcpkg 需要2021.05.11以上版本
4848
vcpkg 主要为了方便安装jsoncpp,如果你想自己配置jsoncpp的环境,可以不使用vcpkg...
4949

5050
##### XEngine环境
51-
XEngine可以直接下载,下载完毕后添加用户环境变量,需要下面两个
52-
- XEngine_Include 头文件目录地址
53-
- XEngine_Library 库文件目录地址
51+
XEngine通过GIT下载,参考XEngine项目的readme配置环境
5452

5553
#### Linux
5654
Linux使用Makefile编译
@@ -63,7 +61,7 @@ Centos8.x
6361
sudo dnf install jsoncpp-devel
6462

6563
##### XEngine环境
66-
XEngine可以通过脚本文件安装sudo XEngine_RunEnv.sh -i 3
64+
XEngine可以通过脚本文件安装sudo XEngine_LINEnv.sh -i 3
6765
##### 编译命令
6866
在XEngine_Source目录下执行命令
6967
make 编译
@@ -97,7 +95,9 @@ P2P分布式下载已经支持,不过目前只能在局域网中,暂时不支持
9795
P2P分布式下载与其他下载工具的超线程下载一样,原理是使用HTTP RANGE字段实现.各位可以通过libcurl等库实现此功能.
9896

9997
## 当前任务
100-
扩展管理接口
98+
P2P广域网文件查找与下载支持
99+
文件发送使用系统事件
100+
下载限速优化
101101

102102
## 其他问题
103103
你可以参考docment目录下的文档.里面包含了API协议和服务说明.
@@ -109,6 +109,10 @@ P2P分布式下载与其他下载工具的超线程下载一样,原理是使用H
109109
3. 提交代码
110110
4. 新建 Pull Request
111111

112+
## 绿色声明
113+
此软件不会产生任何文件到你的系统的其他目录中.
114+
此软件可通过直接删除主目录而达到完全清理目的.
115+
112116
## 关注我们
113117
如果你觉得这个软件对你有帮助,请你给我们一个START吧
114118

XEngine_Docment/Docment_en.docx

2.25 KB
Binary file not shown.

XEngine_Docment/Docment_zh.docx

2.32 KB
Binary file not shown.

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"XLimit": {
5757
"nDLTry": 100,
5858
"nDLError": 10,
59-
"nMaxUPLoad": 0,
59+
"nMaxUPLoad": 1024000,
6060
"nMaxDNLoad": 10240000
6161
},
6262
"XP2xp": {
@@ -68,6 +68,7 @@
6868
},
6969
"XVer": {
7070
"StorageVersion": [
71+
"2.3.0.1001 Build20210903",
7172
"2.2.0.1001 Build20210820",
7273
"2.1.0.1001 Build20210805",
7374
"2.0.0.1001 Build20210723",

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ typedef struct tag_XEngine_ServerConfig
1717
{
1818
TCHAR tszIPAddr[128];
1919
BOOL bDeamon;
20+
BOOL bReuseraddr;
2021
int nCenterPort;
2122
int nStorageDLPort;
2223
int nStorageUPPort;

XEngine_Source/StorageModule_Session/Session_Define.h

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ typedef struct
3131
__int64x ullRWLen; //已经读取(写入)的大小
3232
__int64x ullPosStart; //开始位置
3333
__int64x ullPosEnd; //结束位置
34+
int nPoolIndex; //任务池索引
3435
FILE* pSt_File;
3536
}SESSION_STORAGEINFO;
3637
//////////////////////////////////////////////////////////////////////////
@@ -158,8 +159,8 @@ extern "C" BOOL Session_DLStroage_Destory();
158159
*********************************************************************/
159160
extern "C" BOOL Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszFileDir, __int64x * pInt_Count, __int64x * pInt_LeftCount, int nPosStart = 0, int nPostEnd = 0);
160161
/********************************************************************
161-
函数名称:Session_DLStroage_GetList
162-
函数功能:获得下载器中的列表索引信息
162+
函数名称:Session_DLStroage_GetBuffer
163+
函数功能:获得下载器中指定缓冲区
163164
参数.一:nPool
164165
In/Out:In
165166
类型:整数型
@@ -184,7 +185,7 @@ extern "C" BOOL Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszFil
184185
意思:是否成功
185186
备注:
186187
*********************************************************************/
187-
extern "C" BOOL Session_DLStroage_GetList(int nPool, LPCTSTR lpszClientAddr, TCHAR * ptszMsgBuffer, int* pInt_MsgLen);
188+
extern "C" BOOL Session_DLStroage_GetBuffer(int nPool, LPCTSTR lpszClientAddr, TCHAR * ptszMsgBuffer, int* pInt_MsgLen);
188189
/********************************************************************
189190
函数名称:Session_DLStroage_GetInfo
190191
函数功能:获取下载信息
@@ -258,6 +259,25 @@ extern "C" BOOL Session_DLStroage_GetCount(int nPool, list<string>*pStl_ListClie
258259
*********************************************************************/
259260
extern "C" BOOL Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int nSeek, BOOL bError = TRUE, SESSION_STORAGEDYNAMICRATE * pSt_StorageRate = NULL);
260261
/********************************************************************
262+
函数名称:Session_DLStorage_GetAll
263+
函数功能:获取下载池的任务列表
264+
参数.一:pppSt_StorageInfo
265+
In/Out:Out
266+
类型:三级指针
267+
可空:N
268+
意思:输出获取到的下载信息列表
269+
参数.二:pInt_ListCount
270+
In/Out:Out
271+
类型:整数型指针
272+
可空:N
273+
意思:输出获取到的列表个数
274+
返回值
275+
类型:逻辑型
276+
意思:是否成功
277+
备注:
278+
*********************************************************************/
279+
extern "C" BOOL Session_DLStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
280+
/********************************************************************
261281
函数名称:Session_DLStroage_Delete
262282
函数功能:删除一个队列
263283
参数.一:lpszClientAddr
@@ -405,6 +425,25 @@ extern "C" BOOL Session_UPStroage_Write(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgB
405425
*********************************************************************/
406426
extern "C" BOOL Session_UPStroage_Exist(LPCTSTR lpszClientAddr);
407427
/********************************************************************
428+
函数名称:Session_UPStorage_GetAll
429+
函数功能:获取所有上传信息
430+
参数.一:pppSt_StorageInfo
431+
In/Out:Out
432+
类型:三级指针
433+
可空:N
434+
意思:输出获取到的上传信息列表
435+
参数.二:pInt_ListCount
436+
In/Out:Out
437+
类型:整数型指针
438+
可空:N
439+
意思:输出获取到的列表个数
440+
返回值
441+
类型:逻辑型
442+
意思:是否成功
443+
备注:
444+
*********************************************************************/
445+
extern "C" BOOL Session_UPStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
446+
/********************************************************************
408447
函数名称:Session_UPStroage_Delete
409448
函数功能:删除上传会话
410449
参数.一:lpszClientAddr

XEngine_Source/StorageModule_Session/Session_Error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
#define ERROR_STORAGE_MODULE_SESSION_EXIST 0x0010002
1818
#define ERROR_STORAGE_MODULE_SESSION_OPENFILE 0x0010003
1919
#define ERROR_STORAGE_MODULE_SESSION_NOTFOUND 0x0010004
20-
#define ERROR_STORAGE_MODULE_SESSION_PASSWORD 0x0010005
20+
#define ERROR_STORAGE_MODULE_SESSION_PASSWORD 0x0010005
21+
#define ERROR_STORAGE_MODULE_SESSION_EMPTY 0x0010006

XEngine_Source/StorageModule_Session/Session_Stroage/Session_DLStroage.cpp

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,15 @@ BOOL CSession_DLStroage::Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTST
231231
}
232232
stl_MapIterator = stl_MapStroage.find(nListPos);
233233
stl_MapIterator->second.st_Locker->lock();
234+
st_Client.nPoolIndex = nListPos;
234235
stl_MapIterator->second.pStl_ListStorage->push_back(st_Client);
235236
stl_MapIterator->second.st_Locker->unlock();
236237
st_Locker.unlock();
237238
return TRUE;
238239
}
239240
/********************************************************************
240-
函数名称:Session_DLStroage_GetList
241-
函数功能:获得下载器中的列表索引信息
241+
函数名称:Session_DLStroage_GetBuffer
242+
函数功能:获得下载器中指定缓冲区
242243
参数.一:nPool
243244
In/Out:In
244245
类型:整数型
@@ -263,7 +264,7 @@ BOOL CSession_DLStroage::Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTST
263264
意思:是否成功
264265
备注:
265266
*********************************************************************/
266-
BOOL CSession_DLStroage::Session_DLStroage_GetList(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen)
267+
BOOL CSession_DLStroage::Session_DLStroage_GetBuffer(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen)
267268
{
268269
Session_IsErrorOccur = FALSE;
269270

@@ -528,6 +529,68 @@ BOOL CSession_DLStroage::Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int n
528529
return TRUE;
529530
}
530531
/********************************************************************
532+
函数名称:Session_DLStorage_GetAll
533+
函数功能:获取下载池的任务列表
534+
参数.一:pppSt_StorageInfo
535+
In/Out:Out
536+
类型:三级指针
537+
可空:N
538+
意思:输出获取到的下载信息列表
539+
参数.二:pInt_ListCount
540+
In/Out:Out
541+
类型:整数型指针
542+
可空:N
543+
意思:输出获取到的列表个数
544+
返回值
545+
类型:逻辑型
546+
意思:是否成功
547+
备注:
548+
*********************************************************************/
549+
BOOL CSession_DLStroage::Session_DLStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount)
550+
{
551+
Session_IsErrorOccur = FALSE;
552+
553+
if ((NULL == pppSt_StorageInfo) || (NULL == pInt_ListCount))
554+
{
555+
Session_IsErrorOccur = TRUE;
556+
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_PARAMENT;
557+
return FALSE;
558+
}
559+
560+
int nIndex = 0;
561+
int nListCount = 0;
562+
st_Locker.lock_shared();
563+
unordered_map<int, SESSION_STORAGELIST>::iterator stl_MapIterator = stl_MapStroage.begin();
564+
for (; stl_MapIterator != stl_MapStroage.end(); stl_MapIterator++)
565+
{
566+
nListCount += stl_MapIterator->second.pStl_ListStorage->size();
567+
}
568+
stl_MapIterator = stl_MapStroage.begin();
569+
for (; stl_MapIterator != stl_MapStroage.end(); stl_MapIterator++)
570+
{
571+
*pInt_ListCount = nListCount;
572+
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_StorageInfo, nListCount, sizeof(SESSION_STORAGELIST));
573+
574+
stl_MapIterator->second.st_Locker->lock_shared();
575+
list<SESSION_STORAGEINFO>::iterator stl_ListIterator = stl_MapIterator->second.pStl_ListStorage->begin();
576+
for (; stl_ListIterator != stl_MapIterator->second.pStl_ListStorage->end(); stl_ListIterator++)
577+
{
578+
*(*pppSt_StorageInfo)[nIndex] = *stl_ListIterator;
579+
nIndex++;
580+
}
581+
stl_MapIterator->second.st_Locker->unlock_shared();
582+
}
583+
st_Locker.unlock_shared();
584+
585+
if (*pInt_ListCount <= 0)
586+
{
587+
Session_IsErrorOccur = TRUE;
588+
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_EMPTY;
589+
return FALSE;
590+
}
591+
return TRUE;
592+
}
593+
/********************************************************************
531594
函数名称:Session_DLStroage_Delete
532595
函数功能:删除一个队列
533596
参数.一:lpszClientAddr

XEngine_Source/StorageModule_Session/Session_Stroage/Session_DLStroage.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Purpose: 存储下载会话
1111
// History:
1212
*********************************************************************/
13-
#define XENGINE_STOREAGE_SESSION_DOWNLOAD_SENDTIME 10
13+
#define XENGINE_STOREAGE_SESSION_DOWNLOAD_SENDTIME 50
1414

1515
typedef struct
1616
{
@@ -27,10 +27,11 @@ class CSession_DLStroage
2727
BOOL Session_DLStroage_Init(int nPoolCount = 1, int nTryTime = 3, int nAutoSpeed = 3);
2828
BOOL Session_DLStroage_Destory();
2929
BOOL Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszFileDir, __int64x* pInt_Count, __int64x* pInt_LeftCount, int nPosStart = 0, int nPostEnd = 0);
30-
BOOL Session_DLStroage_GetList(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
30+
BOOL Session_DLStroage_GetBuffer(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
3131
BOOL Session_DLStroage_GetInfo(int nPool, LPCTSTR lpszClientAddr, SESSION_STORAGEINFO* pSt_StorageInfo);
3232
BOOL Session_DLStroage_GetCount(int nPool, list<string>* pStl_ListClient);
3333
BOOL Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int nSeek, BOOL bError = TRUE, SESSION_STORAGEDYNAMICRATE* pSt_StorageRate = NULL);
34+
BOOL Session_DLStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
3435
BOOL Session_DLStroage_Delete(LPCTSTR lpszClientAddr);
3536
private:
3637
int m_nTryTime;

0 commit comments

Comments
 (0)