Skip to content

Commit 0d231c5

Browse files
committed
fixed:Specifying the bucket name does not handle problem of space size
1 parent 5829f12 commit 0d231c5

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

XEngine_Source/StorageModule_APIHelp/APIHelp_Distributed/APIHelp_Distributed.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,25 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
257257
{
258258
return FALSE;
259259
}
260+
//判断目录大小是否正常
261+
int nListCount = 0;
262+
__int64u nDirCount = 0; //当前目录大小
263+
CHAR** ppListFile;
264+
SystemApi_File_EnumFile(pSt_StorageBucket->tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
265+
for (int j = 0; j < nListCount; j++)
266+
{
267+
struct __stat64 st_FStat;
268+
_stat64(ppListFile[j], &st_FStat);
269+
nDirCount += st_FStat.st_size;
270+
}
271+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppListFile, nListCount);
272+
//如果当前目录大小大于设定的大小.
273+
if (nDirCount >= APIHelp_Distributed_GetSize(pSt_StorageBucket->tszBuckSize))
274+
{
275+
APIHelp_IsErrorOccur = TRUE;
276+
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_SIZE;
277+
return FALSE;
278+
}
260279
}
261280
else
262281
{

XEngine_Source/StorageModule_APIHelp/APIHelp_Error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
#define ERROR_STORAGE_MODULE_APIHELP_NOTLENGTH 0x0030012 //没有长度信息
1919
#define ERROR_STORAGE_MODULE_APIHELP_PARSELEN 0x0030013 //解析长度失败
2020
#define ERROR_STORAGE_MODULE_APIHELP_NOTHASH 0x0030014 //没有HASH值
21-
#define ERROR_STORAGE_MODULE_APIHELP_NOTMATCH 0x0030015 //HASH不匹配
21+
#define ERROR_STORAGE_MODULE_APIHELP_NOTMATCH 0x0030015 //HASH不匹配
22+
#define ERROR_STORAGE_MODULE_APIHELP_SIZE 0x0030016 //目录大小已经满了

XEngine_Source/XEngine_StorageApp/StorageApp_Download.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ void CALLBACK XEngine_Download_CBSend(LPCSTR lpszClientAddr, SOCKET hSocket, LPV
6464
memset(&st_StorageInfo, '\0', sizeof(SESSION_STORAGEINFO));
6565

6666
Session_DLStroage_GetInfo(lpszClientAddr, &st_StorageInfo);
67-
6867
Protocol_StoragePacket_UPDown(tszProxyStr, &nPLen, st_StorageInfo.tszFileDir, st_StorageInfo.tszBuckKey, st_StorageInfo.tszClientAddr, st_StorageInfo.ullRWCount, TRUE, st_StorageInfo.tszFileHash);
6968
if (APIHelp_HttpRequest_Post(st_ServiceCfg.st_XProxy.st_XProxyPass.tszDLPass, tszProxyStr, &nHttpCode))
7069
{

0 commit comments

Comments
 (0)