Skip to content

Commit

Permalink
Merge pull request #11 from libxengine/develop
Browse files Browse the repository at this point in the history
V2.3版本合并
  • Loading branch information
xengine-qyt authored Sep 3, 2021
2 parents f2e58e1 + 85bc421 commit 6acb42f
Show file tree
Hide file tree
Showing 28 changed files with 428 additions and 72 deletions.
16 changes: 10 additions & 6 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ vcpkg integrate install
you can not use vcpkg and config jsoncpp development for youself

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

#### Linux
Linux use Makefile to complie
Expand All @@ -66,7 +64,7 @@ sudo dnf install jsoncpp-devel

##### XEngine Install
you can install xengine env to your system by shell
like this:sudo XEngine_RunEnv.sh -i 3
like this:sudo XEngine_LINEnv.sh -i 3
##### complie
execute command in XEngine_Source path
make complie
Expand All @@ -87,7 +85,7 @@ The Second pass is not realized by the server, it is by the client
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.
The realization of downloading second transmission is to first query the local file save path through HASH, and download it directly if it exists.

## 关于P2P
## about P2P
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
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.

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

## now task
expand management interface
P2P WAN file search and download support
file send use system event
Download speed limit optimization

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

## Clean up statement
the software will not generate any files to other directories in your system.
the software can achieve complete cleanup by directly delete the directory.

## Follow us
If you think this software is helpful to you, please give us a START

Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ vcpkg 需要2021.05.11以上版本
vcpkg 主要为了方便安装jsoncpp,如果你想自己配置jsoncpp的环境,可以不使用vcpkg...

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

#### Linux
Linux使用Makefile编译
Expand All @@ -63,7 +61,7 @@ Centos8.x
sudo dnf install jsoncpp-devel

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

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

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

## 绿色声明
此软件不会产生任何文件到你的系统的其他目录中.
此软件可通过直接删除主目录而达到完全清理目的.

## 关注我们
如果你觉得这个软件对你有帮助,请你给我们一个START吧

Expand Down
Binary file modified XEngine_Docment/Docment_en.docx
Binary file not shown.
Binary file modified XEngine_Docment/Docment_zh.docx
Binary file not shown.
3 changes: 2 additions & 1 deletion XEngine_Release/XEngine_Config/XEngine_Config.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"XLimit": {
"nDLTry": 100,
"nDLError": 10,
"nMaxUPLoad": 0,
"nMaxUPLoad": 1024000,
"nMaxDNLoad": 10240000
},
"XP2xp": {
Expand All @@ -68,6 +68,7 @@
},
"XVer": {
"StorageVersion": [
"2.3.0.1001 Build20210903",
"2.2.0.1001 Build20210820",
"2.1.0.1001 Build20210805",
"2.0.0.1001 Build20210723",
Expand Down
1 change: 1 addition & 0 deletions XEngine_Source/StorageModule_Config/Config_Define.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef struct tag_XEngine_ServerConfig
{
TCHAR tszIPAddr[128];
BOOL bDeamon;
BOOL bReuseraddr;
int nCenterPort;
int nStorageDLPort;
int nStorageUPPort;
Expand Down
45 changes: 42 additions & 3 deletions XEngine_Source/StorageModule_Session/Session_Define.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typedef struct
__int64x ullRWLen; //已经读取(写入)的大小
__int64x ullPosStart; //开始位置
__int64x ullPosEnd; //结束位置
int nPoolIndex; //任务池索引
FILE* pSt_File;
}SESSION_STORAGEINFO;
//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -158,8 +159,8 @@ extern "C" BOOL Session_DLStroage_Destory();
*********************************************************************/
extern "C" BOOL Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszFileDir, __int64x * pInt_Count, __int64x * pInt_LeftCount, int nPosStart = 0, int nPostEnd = 0);
/********************************************************************
函数名称:Session_DLStroage_GetList
函数功能:获得下载器中的列表索引信息
函数名称:Session_DLStroage_GetBuffer
函数功能:获得下载器中指定缓冲区
参数.一:nPool
In/Out:In
类型:整数型
Expand All @@ -184,7 +185,7 @@ extern "C" BOOL Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszFil
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Session_DLStroage_GetList(int nPool, LPCTSTR lpszClientAddr, TCHAR * ptszMsgBuffer, int* pInt_MsgLen);
extern "C" BOOL Session_DLStroage_GetBuffer(int nPool, LPCTSTR lpszClientAddr, TCHAR * ptszMsgBuffer, int* pInt_MsgLen);
/********************************************************************
函数名称:Session_DLStroage_GetInfo
函数功能:获取下载信息
Expand Down Expand Up @@ -258,6 +259,25 @@ extern "C" BOOL Session_DLStroage_GetCount(int nPool, list<string>*pStl_ListClie
*********************************************************************/
extern "C" BOOL Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int nSeek, BOOL bError = TRUE, SESSION_STORAGEDYNAMICRATE * pSt_StorageRate = NULL);
/********************************************************************
函数名称:Session_DLStorage_GetAll
函数功能:获取下载池的任务列表
参数.一:pppSt_StorageInfo
In/Out:Out
类型:三级指针
可空:N
意思:输出获取到的下载信息列表
参数.二:pInt_ListCount
In/Out:Out
类型:整数型指针
可空:N
意思:输出获取到的列表个数
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Session_DLStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
/********************************************************************
函数名称:Session_DLStroage_Delete
函数功能:删除一个队列
参数.一:lpszClientAddr
Expand Down Expand Up @@ -405,6 +425,25 @@ extern "C" BOOL Session_UPStroage_Write(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgB
*********************************************************************/
extern "C" BOOL Session_UPStroage_Exist(LPCTSTR lpszClientAddr);
/********************************************************************
函数名称:Session_UPStorage_GetAll
函数功能:获取所有上传信息
参数.一:pppSt_StorageInfo
In/Out:Out
类型:三级指针
可空:N
意思:输出获取到的上传信息列表
参数.二:pInt_ListCount
In/Out:Out
类型:整数型指针
可空:N
意思:输出获取到的列表个数
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Session_UPStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
/********************************************************************
函数名称:Session_UPStroage_Delete
函数功能:删除上传会话
参数.一:lpszClientAddr
Expand Down
3 changes: 2 additions & 1 deletion XEngine_Source/StorageModule_Session/Session_Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
#define ERROR_STORAGE_MODULE_SESSION_EXIST 0x0010002
#define ERROR_STORAGE_MODULE_SESSION_OPENFILE 0x0010003
#define ERROR_STORAGE_MODULE_SESSION_NOTFOUND 0x0010004
#define ERROR_STORAGE_MODULE_SESSION_PASSWORD 0x0010005
#define ERROR_STORAGE_MODULE_SESSION_PASSWORD 0x0010005
#define ERROR_STORAGE_MODULE_SESSION_EMPTY 0x0010006
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,15 @@ BOOL CSession_DLStroage::Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTST
}
stl_MapIterator = stl_MapStroage.find(nListPos);
stl_MapIterator->second.st_Locker->lock();
st_Client.nPoolIndex = nListPos;
stl_MapIterator->second.pStl_ListStorage->push_back(st_Client);
stl_MapIterator->second.st_Locker->unlock();
st_Locker.unlock();
return TRUE;
}
/********************************************************************
函数名称:Session_DLStroage_GetList
函数功能:获得下载器中的列表索引信息
函数名称:Session_DLStroage_GetBuffer
函数功能:获得下载器中指定缓冲区
参数.一:nPool
In/Out:In
类型:整数型
Expand All @@ -263,7 +264,7 @@ BOOL CSession_DLStroage::Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTST
意思:是否成功
备注:
*********************************************************************/
BOOL CSession_DLStroage::Session_DLStroage_GetList(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen)
BOOL CSession_DLStroage::Session_DLStroage_GetBuffer(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen)
{
Session_IsErrorOccur = FALSE;

Expand Down Expand Up @@ -528,6 +529,68 @@ BOOL CSession_DLStroage::Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int n
return TRUE;
}
/********************************************************************
函数名称:Session_DLStorage_GetAll
函数功能:获取下载池的任务列表
参数.一:pppSt_StorageInfo
In/Out:Out
类型:三级指针
可空:N
意思:输出获取到的下载信息列表
参数.二:pInt_ListCount
In/Out:Out
类型:整数型指针
可空:N
意思:输出获取到的列表个数
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CSession_DLStroage::Session_DLStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount)
{
Session_IsErrorOccur = FALSE;

if ((NULL == pppSt_StorageInfo) || (NULL == pInt_ListCount))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_PARAMENT;
return FALSE;
}

int nIndex = 0;
int nListCount = 0;
st_Locker.lock_shared();
unordered_map<int, SESSION_STORAGELIST>::iterator stl_MapIterator = stl_MapStroage.begin();
for (; stl_MapIterator != stl_MapStroage.end(); stl_MapIterator++)
{
nListCount += stl_MapIterator->second.pStl_ListStorage->size();
}
stl_MapIterator = stl_MapStroage.begin();
for (; stl_MapIterator != stl_MapStroage.end(); stl_MapIterator++)
{
*pInt_ListCount = nListCount;
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_StorageInfo, nListCount, sizeof(SESSION_STORAGELIST));

stl_MapIterator->second.st_Locker->lock_shared();
list<SESSION_STORAGEINFO>::iterator stl_ListIterator = stl_MapIterator->second.pStl_ListStorage->begin();
for (; stl_ListIterator != stl_MapIterator->second.pStl_ListStorage->end(); stl_ListIterator++)
{
*(*pppSt_StorageInfo)[nIndex] = *stl_ListIterator;
nIndex++;
}
stl_MapIterator->second.st_Locker->unlock_shared();
}
st_Locker.unlock_shared();

if (*pInt_ListCount <= 0)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_EMPTY;
return FALSE;
}
return TRUE;
}
/********************************************************************
函数名称:Session_DLStroage_Delete
函数功能:删除一个队列
参数.一:lpszClientAddr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Purpose: 存储下载会话
// History:
*********************************************************************/
#define XENGINE_STOREAGE_SESSION_DOWNLOAD_SENDTIME 10
#define XENGINE_STOREAGE_SESSION_DOWNLOAD_SENDTIME 50

typedef struct
{
Expand All @@ -27,10 +27,11 @@ class CSession_DLStroage
BOOL Session_DLStroage_Init(int nPoolCount = 1, int nTryTime = 3, int nAutoSpeed = 3);
BOOL Session_DLStroage_Destory();
BOOL Session_DLStroage_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszFileDir, __int64x* pInt_Count, __int64x* pInt_LeftCount, int nPosStart = 0, int nPostEnd = 0);
BOOL Session_DLStroage_GetList(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
BOOL Session_DLStroage_GetBuffer(int nPool, LPCTSTR lpszClientAddr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
BOOL Session_DLStroage_GetInfo(int nPool, LPCTSTR lpszClientAddr, SESSION_STORAGEINFO* pSt_StorageInfo);
BOOL Session_DLStroage_GetCount(int nPool, list<string>* pStl_ListClient);
BOOL Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int nSeek, BOOL bError = TRUE, SESSION_STORAGEDYNAMICRATE* pSt_StorageRate = NULL);
BOOL Session_DLStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
BOOL Session_DLStroage_Delete(LPCTSTR lpszClientAddr);
private:
int m_nTryTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,59 @@ BOOL CSession_UPStroage::Session_UPStroage_Exist(LPCTSTR lpszClientAddr)
return bRet;
}
/********************************************************************
函数名称:Session_UPStorage_GetAll
函数功能:获取所有上传信息
参数.一:pppSt_StorageInfo
In/Out:Out
类型:三级指针
可空:N
意思:输出获取到的上传信息列表
参数.二:pInt_ListCount
In/Out:Out
类型:整数型指针
可空:N
意思:输出获取到的列表个数
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CSession_UPStroage::Session_UPStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount)
{
Session_IsErrorOccur = FALSE;

if (NULL == pInt_ListCount)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_PARAMENT;
return FALSE;
}

if (NULL == pppSt_StorageInfo)
{
*pInt_ListCount = stl_MapStroage.size();
return TRUE;
}

st_Locker.lock_shared();
*pInt_ListCount = stl_MapStroage.size();
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_StorageInfo, *pInt_ListCount, sizeof(SESSION_STORAGEINFO));
unordered_map<tstring, SESSION_STORAGEUPLOADER>::iterator stl_MapIterator = stl_MapStroage.begin();
for (int i = 0; stl_MapIterator != stl_MapStroage.end(); stl_MapIterator++, i++)
{
*(*pppSt_StorageInfo)[i] = stl_MapIterator->second.st_StorageInfo;
}
st_Locker.unlock_shared();

if (0 == *pInt_ListCount)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_EMPTY;
return FALSE;
}
return TRUE;
}
/********************************************************************
函数名称:Session_UPStroage_Delete
函数功能:删除上传会话
参数.一:lpszClientAddr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CSession_UPStroage
BOOL Session_UPStroage_GetInfo(LPCTSTR lpszClientAddr, SESSION_STORAGEINFO* pSt_StorageInfo);
BOOL Session_UPStroage_Write(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen);
BOOL Session_UPStroage_Exist(LPCTSTR lpszClientAddr);
BOOL Session_UPStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
BOOL Session_UPStroage_Delete(LPCTSTR lpszClientAddr);
private:
shared_mutex st_Locker;
Expand Down
Loading

0 comments on commit 6acb42f

Please sign in to comment.