Skip to content

Commit c94075d

Browse files
committed
fixed:cal file hash value is corrent
1 parent 66e3425 commit c94075d

File tree

6 files changed

+53
-3
lines changed

6 files changed

+53
-3
lines changed

XEngine_Source/StorageModule_Session/Session_Define.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,18 @@ extern "C" BOOL Session_UPStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInf
422422
意思:是否成功
423423
备注:
424424
*********************************************************************/
425-
extern "C" BOOL Session_UPStroage_Delete(LPCTSTR lpszClientAddr);
425+
extern "C" BOOL Session_UPStroage_Delete(LPCTSTR lpszClientAddr);
426+
/********************************************************************
427+
函数名称:Session_UPStroage_Close
428+
函数功能:关闭读写文件句柄
429+
参数.一:lpszClientAddr
430+
In/Out:In
431+
类型:常量字符指针
432+
可空:N
433+
意思:要关闭的客户端会话
434+
返回值
435+
类型:逻辑型
436+
意思:是否成功
437+
备注:
438+
*********************************************************************/
439+
extern "C" BOOL Session_UPStroage_Close(LPCTSTR lpszClientAddr);

XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,33 @@ BOOL CSession_UPStroage::Session_UPStroage_Delete(LPCTSTR lpszClientAddr)
384384
}
385385
st_Locker.unlock();
386386
return TRUE;
387+
}
388+
/********************************************************************
389+
函数名称:Session_UPStroage_Close
390+
函数功能:关闭读写文件句柄
391+
参数.一:lpszClientAddr
392+
In/Out:In
393+
类型:常量字符指针
394+
可空:N
395+
意思:要关闭的客户端会话
396+
返回值
397+
类型:逻辑型
398+
意思:是否成功
399+
备注:
400+
*********************************************************************/
401+
BOOL CSession_UPStroage::Session_UPStroage_Close(LPCTSTR lpszClientAddr)
402+
{
403+
Session_IsErrorOccur = FALSE;
404+
405+
st_Locker.lock_shared();
406+
unordered_map<string, SESSION_STORAGEUPLOADER>::iterator stl_MapIterator = stl_MapStroage.find(lpszClientAddr);
407+
if (stl_MapIterator != stl_MapStroage.end())
408+
{
409+
if (NULL != stl_MapIterator->second.st_StorageInfo.pSt_File)
410+
{
411+
fclose(stl_MapIterator->second.st_StorageInfo.pSt_File);
412+
}
413+
}
414+
st_Locker.unlock_shared();
415+
return TRUE;
387416
}

XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class CSession_UPStroage
3030
BOOL Session_UPStroage_Exist(LPCTSTR lpszClientAddr);
3131
BOOL Session_UPStorage_GetAll(SESSION_STORAGEINFO*** pppSt_StorageInfo, int* pInt_ListCount);
3232
BOOL Session_UPStroage_Delete(LPCTSTR lpszClientAddr);
33+
BOOL Session_UPStroage_Close(LPCTSTR lpszClientAddr);
3334
private:
3435
BOOL m_bResume;
3536
private:

XEngine_Source/StorageModule_Session/StorageModule_Session.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ EXPORTS
2424
Session_UPStroage_Write
2525
Session_UPStroage_Exist
2626
Session_UPStorage_GetAll
27-
Session_UPStroage_Delete
27+
Session_UPStroage_Delete
28+
Session_UPStroage_Close

XEngine_Source/StorageModule_Session/pch.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,8 @@ extern "C" BOOL Session_UPStorage_GetAll(SESSION_STORAGEINFO * **pppSt_StorageIn
115115
extern "C" BOOL Session_UPStroage_Delete(LPCTSTR lpszClientAddr)
116116
{
117117
return m_UPStorage.Session_UPStroage_Delete(lpszClientAddr);
118+
}
119+
extern "C" BOOL Session_UPStroage_Close(LPCTSTR lpszClientAddr)
120+
{
121+
return m_UPStorage.Session_UPStroage_Close(lpszClientAddr);
118122
}

XEngine_Source/XEngine_StorageApp/StorageApp_UPLoader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ BOOL XEngine_Task_HttpUPLoader(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, in
266266
_tcscpy(st_ProtocolFile.st_ProtocolFile.tszFileName, tszFileName);
267267
_tcscpy(st_ProtocolFile.tszBuckKey, st_StorageBucket.tszBuckKey);
268268
st_ProtocolFile.st_ProtocolFile.nFileSize = st_StorageInfo.ullRWLen;
269-
269+
//上传完毕需要关闭,否则计算HASH会不正常
270+
Session_UPStroage_Close(lpszClientAddr);
270271
OPenSsl_Api_Digest(tszFileDir, tszHashStr, &nHashLen, TRUE, st_ServiceCfg.st_XStorage.nHashMode);
271272
BaseLib_OperatorString_StrToHex((char*)tszHashStr, nHashLen, st_ProtocolFile.st_ProtocolFile.tszFileHash);
272273
//处理结果

0 commit comments

Comments
 (0)