@@ -231,6 +231,7 @@ 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 ();
@@ -529,18 +530,13 @@ BOOL CSession_DLStroage::Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int n
529530}
530531/* *******************************************************************
531532函数名称:Session_DLStorage_GetAll
532- 函数功能:获取指定下载池的任务列表
533- 参数.一:nPool
534- In/Out:In
535- 类型:整数型
536- 可空:N
537- 意思:输入要获取的任务池ID
538- 参数.二:pppSt_StorageInfo
533+ 函数功能:获取下载池的任务列表
534+ 参数.一:pppSt_StorageInfo
539535 In/Out:Out
540536 类型:三级指针
541537 可空:N
542538 意思:输出获取到的下载信息列表
543- 参数.三 :pInt_ListCount
539+ 参数.二 :pInt_ListCount
544540 In/Out:Out
545541 类型:整数型指针
546542 可空:N
@@ -550,7 +546,7 @@ BOOL CSession_DLStroage::Session_DLStorage_SetSeek(LPCTSTR lpszClientAddr, int n
550546 意思:是否成功
551547备注:
552548*********************************************************************/
553- BOOL CSession_DLStroage::Session_DLStorage_GetAll (int nPool, SESSION_STORAGEINFO*** pppSt_StorageInfo, int * pInt_ListCount)
549+ BOOL CSession_DLStroage::Session_DLStorage_GetAll (SESSION_STORAGEINFO*** pppSt_StorageInfo, int * pInt_ListCount)
554550{
555551 Session_IsErrorOccur = FALSE ;
556552
@@ -561,19 +557,26 @@ BOOL CSession_DLStroage::Session_DLStorage_GetAll(int nPool, SESSION_STORAGEINFO
561557 return FALSE ;
562558 }
563559
564- BOOL bFound = FALSE ;
560+ int nIndex = 0 ;
561+ int nListCount = 0 ;
565562 st_Locker.lock_shared ();
566- unordered_map<int , SESSION_STORAGELIST>::iterator stl_MapIterator = stl_MapStroage.find (nPool);
567- if (stl_MapIterator != stl_MapStroage.end ())
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++)
568570 {
569- *pInt_ListCount = stl_MapIterator-> second . pStl_ListStorage -> size () ;
570- BaseLib_OperatorMemory_Malloc ((XPPPMEM)pppSt_StorageInfo, *pInt_ListCount , sizeof (SESSION_STORAGELIST));
571+ *pInt_ListCount = nListCount ;
572+ BaseLib_OperatorMemory_Malloc ((XPPPMEM)pppSt_StorageInfo, nListCount , sizeof (SESSION_STORAGELIST));
571573
572574 stl_MapIterator->second .st_Locker ->lock_shared ();
573575 list<SESSION_STORAGEINFO>::iterator stl_ListIterator = stl_MapIterator->second .pStl_ListStorage ->begin ();
574- for (int i = 0 ; stl_ListIterator != stl_MapIterator->second .pStl_ListStorage ->end (); stl_ListIterator++, i ++)
576+ for (; stl_ListIterator != stl_MapIterator->second .pStl_ListStorage ->end (); stl_ListIterator++)
575577 {
576- *(*pppSt_StorageInfo)[i] = *stl_ListIterator;
578+ *(*pppSt_StorageInfo)[nIndex] = *stl_ListIterator;
579+ nIndex++;
577580 }
578581 stl_MapIterator->second .st_Locker ->unlock_shared ();
579582 }
0 commit comments