CSocketThreadManagerImp Class Reference#include <SocketThreadManagerImp.h>
Inheritance diagram for CSocketThreadManagerImp:
![]()
Collaboration diagram for CSocketThreadManagerImp:
![]()
Detailed DescriptionDefinition at line 51 of file SocketThreadManagerImp.h. Member Typedef Documentation
Definition at line 66 of file SocketThreadManager.h.
Definition at line 168 of file SocketThreadManager.h.
Constructor & Destructor Documentation
Definition at line 78 of file SocketThreadManagerImp.cpp. 00078 : CSocketThreadManager(hInstance), 00079 m_hLocalInstance(hInstance), 00080 m_bStatic(FALSE) 00081 { 00082 try 00083 { 00084 //Set our name 00085 SetName(CSocketThreadManagerImp_Class); 00086 } 00087 ERROR_HANDLER("CSocketThreadManagerImp") 00088 }
Definition at line 90 of file SocketThreadManagerImp.cpp. 00091 { 00092 try 00093 { 00094 //Are we static version? 00095 if (m_bStatic) 00096 //Remove the window 00097 if (m_bWindow) 00098 { 00099 //Unregister it 00100 ::UnregisterClass(CSocketThreadManagerImp_Class, 00101 m_hInstance); 00102 00103 //No window 00104 m_bWindow=FALSE; 00105 } 00106 else 00107 ; 00108 else 00109 //Uninitialize 00110 Uninitialize(); 00111 } 00112 ERROR_HANDLER("~CSocketThreadManagerImp") 00113 }
Member Function Documentation
Definition at line 680 of file ErrorHandler.cpp. 00681 { 00682 //Delete the logs 00683 delete m_pSecondLevelLog; 00684 m_pSecondLevelLog=NULL; 00685 00686 delete m_pThirdLevelLog; 00687 m_pThirdLevelLog=NULL; 00688 }
Reimplemented from CSocketThreadManager. Definition at line 149 of file SocketThreadManagerImp.cpp. 00150 { 00151 try 00152 { 00153 //Create the struct 00154 ExtensionData* pData; 00155 pData=new ExtensionData; 00156 00157 //Populate it 00158 pData->pCSection=COSManager::CreateCriticalSection(); 00159 00160 //Put it in the data 00161 rData.lpData=(LPVOID)pData; 00162 } 00163 ERROR_HANDLER("CreateExtendedData") 00164 }
Definition at line 550 of file SocketThreadManager.cpp. 00552 { 00553 try 00554 { 00555 //First find the window handle 00556 int iIndex; 00557 iIndex=GetIndexByHWND(hWindowHandle); 00558 00559 //Check it's valid 00560 if (!iIndex) 00561 return; 00562 00563 //Enter the critical section 00564 CCriticalAutoRelease aRelease(m_pCSection); 00565 00566 //Decrement the socket count 00567 if (m_pThreadData[iIndex-1].iSocketCount>0) 00568 { 00569 --m_pThreadData[iIndex-1].iSocketCount; 00570 m_pThreadData[iIndex-1].bFreeze=bFreeze; 00571 } 00572 } 00573 ERROR_HANDLER("DecreaseSocketCount") 00574 }
Definition at line 576 of file SocketThreadManager.cpp. 00578 { 00579 try 00580 { 00581 //First find the window handle 00582 int iIndex; 00583 iIndex=GetIndexByHWND(hWindowHandle); 00584 00585 //Check it's valid 00586 if (!iIndex) 00587 return; 00588 00589 //Enter the critical section 00590 CCriticalAutoRelease aRelease(m_pCSection); 00591 00592 //Decrement the socket count 00593 if (m_pThreadData[iIndex-1].iTimeoutCount>0) 00594 { 00595 --m_pThreadData[iIndex-1].iTimeoutCount; 00596 m_pThreadData[iIndex-1].bFreeze=bFreeze; 00597 } 00598 } 00599 ERROR_HANDLER("DecreaseTimeoutCount") 00600 }
Reimplemented from CSocketThreadManager. Definition at line 166 of file SocketThreadManagerImp.cpp. 00167 { 00168 try 00169 { 00170 //Take the data 00171 ExtensionData* pData; 00172 pData=(ExtensionData*)rData.lpData; 00173 00174 //Is it legal? 00175 if (pData) 00176 { 00177 //Our delete vector 00178 typedef std::vector<CAsyncSocket*> DeleteVector; 00179 00180 //Our vector 00181 DeleteVector aDeleteVector; 00182 00183 { 00184 //Lock the CS 00185 CCriticalAutoRelease aRelease(pData->pCSection); 00186 00187 //Iterate to delete all the data 00188 SocketMap::iterator aIterator; 00189 aIterator=pData->aSocketsMap.begin(); 00190 while (aIterator!=pData->aSocketsMap.end()) 00191 { 00192 //Add the socket 00193 aDeleteVector.push_back(aIterator->second); 00194 00195 //Delete it 00196 aIterator=pData->aSocketsMap.erase(aIterator); 00197 } 00198 } 00199 00200 //Delete the sockets 00201 for (int iCount=0; 00202 iCount<aDeleteVector.size(); 00203 ++iCount) 00204 try 00205 { 00206 //Set to delete 00207 aDeleteVector[iCount]->SetDeleting(); 00208 00209 //Delete the socket 00210 delete aDeleteVector[iCount]; 00211 } 00212 ERROR_HANDLER("DeleteExtendedData - Socket delete") 00213 00214 //Delete the CS 00215 delete pData->pCSection; 00216 00217 //Delete it 00218 delete pData; 00219 00220 //Remove from data 00221 rData.lpData=NULL; 00222 } 00223 } 00224 ERROR_HANDLER("DeleteExtendedData") 00225 }
Definition at line 251 of file ErrorHandler.cpp. 00252 { 00253 try 00254 { 00255 //Try to look it in the errors 00256 if (!CErrorsRepository::GetInstance().GetErrorsMap().empty()) 00257 { 00258 //Search 00259 CErrorsRepository::ErrorMap::const_iterator aIterator; 00260 aIterator=CErrorsRepository::GetInstance().GetErrorsMap().find(dwErrorCode); 00261 00262 //Do we have it 00263 if (aIterator!=CErrorsRepository::GetInstance().GetErrorsMap().end()) 00264 return aIterator->second; 00265 } 00266 00267 //Get the error string 00268 LPVOID lpMsgBuf; 00269 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 00270 FORMAT_MESSAGE_FROM_SYSTEM | 00271 FORMAT_MESSAGE_IGNORE_INSERTS, 00272 NULL, 00273 dwErrorCode, 00274 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language 00275 (LPTSTR) &lpMsgBuf, 00276 0, 00277 NULL); 00278 00279 //Save it 00280 std::string sMessage; 00281 00282 //Do we have the message? 00283 if (lpMsgBuf) 00284 { 00285 //Save it 00286 sMessage=(char*)lpMsgBuf; 00287 00288 //Release the buffer 00289 LocalFree(lpMsgBuf); 00290 } 00291 else 00292 //Failed to find 00293 sMessage="No error description found!"; 00294 00295 //Done 00296 return sMessage; 00297 } 00298 catch (...) 00299 { 00300 return "Unknown"; 00301 } 00302 }
Definition at line 145 of file ErrorHandler.cpp. 00149 { 00150 //Our message 00151 std::string sMsg; 00152 00153 //Is it an error? 00154 if (bError) 00155 sMsg="*** Error *** "; 00156 else 00157 sMsg="### Msg ### "; 00158 00159 //Add the data now 00160 sMsg+="in "+rClass; 00161 sMsg+="::"+rMethod; 00162 sMsg+=" - " + rMsgOrError; 00163 00164 //Done 00165 return sMsg; 00166 }
Definition at line 622 of file ErrorHandler.cpp. 00623 { 00624 try 00625 { 00626 //Our string 00627 std::string sDate; 00628 00629 //Our tmp buf 00630 char cTmp[128]; 00631 00632 //Get date 00633 _strdate(cTmp); 00634 sDate=cTmp; 00635 sDate+=' '; 00636 00637 //Get time 00638 _strtime(cTmp); 00639 sDate+=cTmp; 00640 00641 //Done 00642 return sDate; 00643 } 00644 ERROR_HANDLER_STATIC_RETURN(CErrorHandler_Class,"GetCurrentDateTime","") 00645 }
Definition at line 602 of file SocketThreadManager.cpp. 00603 { 00604 try 00605 { 00606 //Get the index 00607 int iIndex; 00608 iIndex=GetIndexByHWND(hHandle); 00609 00610 //Do we have it? 00611 if (iIndex) 00612 return &m_pThreadData[iIndex-1]; 00613 else 00614 return NULL; 00615 } 00616 ERROR_HANDLER_RETURN("GetDataByHWND",NULL) 00617 }
Definition at line 658 of file ErrorHandler.cpp. 00659 { 00660 //Do we have log 00661 if (!m_pSecondLevelLog) 00662 //Create it 00663 m_pSecondLevelLog=new CErrorHandler; 00664 00665 //Return it 00666 return m_pSecondLevelLog; 00667 }
Definition at line 669 of file ErrorHandler.cpp. 00670 { 00671 //Do we have log 00672 if (!m_pThirdLevelLog) 00673 //Create it 00674 m_pThirdLevelLog=new CErrorHandler; 00675 00676 //Return it 00677 return m_pThirdLevelLog; 00678 }
Definition at line 529 of file SocketThreadManager.cpp. 00530 { 00531 try 00532 { 00533 //First find the window handle 00534 int iIndex; 00535 iIndex=GetIndexByHWND(hWindowHandle); 00536 00537 //Check it's valid 00538 if (!iIndex) 00539 return NULL; 00540 00541 //Enter the critical section 00542 CCriticalAutoRelease aRelease(m_pCSection); 00543 00544 //Return the thread 00545 return m_pThreadData[iIndex-1].pThread; 00546 } 00547 ERROR_HANDLER_RETURN("GetThreadByHWND",NULL) 00548 }
Definition at line 500 of file SocketThreadManager.cpp. 00501 { 00502 try 00503 { 00504 //Shared resource 00505 CCriticalAutoRelease aRelease(m_pCSection); 00506 00507 //Get the freeiest index 00508 int iIndex; 00509 iIndex=GetMostAvailableThread(); 00510 00511 //Check it's valid 00512 if (!iIndex) 00513 //Quit 00514 return 0; 00515 00516 //Check what to increase 00517 if (bTimeout) 00518 ++m_pThreadData[iIndex-1].iTimeoutCount; 00519 else 00520 //Increase the socket count 00521 ++m_pThreadData[iIndex-1].iSocketCount; 00522 00523 //Done 00524 return m_pThreadData[iIndex-1].hWindowHandle; 00525 } 00526 ERROR_HANDLER_RETURN("GetWindowHandle",0) 00527 }
Definition at line 280 of file SocketThreadManagerImp.cpp. 00281 { 00282 try 00283 { 00284 //Allocate a handle 00285 HWND hHandle; 00286 hHandle=CSocketThreadManager::GetWindowHandle(); 00287 00288 //Do we have it? 00289 if (hHandle) 00290 //Add the socket 00291 AddSocketToList(pSocket, 00292 hHandle); 00293 00294 //Done 00295 return hHandle; 00296 } 00297 ERROR_HANDLER_RETURN("GetWindowHandle",NULL) 00298 }
Definition at line 113 of file SocketThreadManager.cpp. 00115 { 00116 try 00117 { 00118 //Are we initialized? 00119 if (m_bInitialized) 00120 { 00121 //Report it 00122 ReportError("Initialize","Already initialized!"); 00123 00124 //Exit 00125 return FALSE; 00126 } 00127 00128 //Check the number of threads 00129 if (ulThreadCount>MAX_THREADS) 00130 { 00131 //Report it 00132 ReportError("Initialize","Too many threads to spawn!"); 00133 00134 //Exit 00135 return FALSE; 00136 } 00137 00138 //Check the number of threads 00139 if (!ulThreadCount) 00140 { 00141 //Report it 00142 ReportError("Initialize","Can't have zero threads!"); 00143 00144 //Exit 00145 return FALSE; 00146 } 00147 00148 //Save the count 00149 m_ulThreadCount=ulThreadCount; 00150 00151 //Try to spawn the threads 00152 return SpawnThreads(lpClassName); 00153 } 00154 ERROR_HANDLER_RETURN("Initialize",FALSE) 00155 }
Definition at line 227 of file SocketThreadManagerImp.cpp. 00228 { 00229 try 00230 { 00231 //First create the window class 00232 if (!m_bWindow) 00233 { 00234 //Save the instance 00235 m_hInstance=m_hLocalInstance; 00236 00237 if (!RegisterWindow(m_hInstance)) 00238 { 00239 //Report it 00240 ReportErrorOS("SetHandlers","Error registering the window, please check API error!"); 00241 00242 //Exit 00243 return FALSE; 00244 } 00245 else 00246 //Window is OK 00247 m_bWindow=TRUE; 00248 } 00249 00250 //Initialize our father 00251 return CSocketThreadManager::Initialize(ulThreadCount, 00252 CSocketThreadManagerImp_Class); 00253 } 00254 ERROR_HANDLER_RETURN("Initialize",FALSE) 00255 }
Reimplemented from CSocketThreadManager. Definition at line 115 of file SocketThreadManagerImp.cpp. 00117 { 00118 //Get the extension data 00119 ExtensionData* pExtension; 00120 pExtension=(ExtensionData*)pData->aExtension.lpData; 00121 00122 //Our new msg 00123 MSG aNewMsg(rMsg); 00124 00125 //Do we have param? 00126 if (rMsg.wParam && 00127 IsSocketMessage(aNewMsg.message)) 00128 { 00129 //Lock the CS 00130 CCriticalAutoRelease aRelease(pExtension->pCSection); 00131 00132 //Try to get the socket 00133 SocketMap::iterator aIterator; 00134 aIterator=pExtension->aSocketsMap.find((int)rMsg.wParam); 00135 00136 //Do we have it? 00137 if (aIterator!=pExtension->aSocketsMap.end()) 00138 //Modify the message 00139 aNewMsg.wParam=(WPARAM)aIterator->second; 00140 else 00141 aNewMsg.wParam=0; 00142 } 00143 00144 //Dispatch it 00145 CSocketThreadManager::ParseDispatchMessage(aNewMsg, 00146 pData); 00147 }
Definition at line 647 of file ErrorHandler.cpp. 00649 { 00650 try 00651 { 00652 //Add the error 00653 CErrorsRepository::GetInstance().GetErrorsMap().insert(CErrorsRepository::ErrorMap::value_type(dwErrorCode,rDescription)); 00654 } 00655 ERROR_HANDLER_STATIC(CErrorHandler_Class,"RegisterError") 00656 }
Definition at line 714 of file SocketThreadManager.cpp. 00721 { 00722 TimerID aTimerID; 00723 aTimerID.iIndex=0; 00724 00725 try 00726 { 00727 //Do we have a timer ? 00728 if (pTimer) 00729 memset(pTimer,0,sizeof(TimerID)); 00730 00731 int iIndex; 00732 00733 //Create the data structure (to save time on the CS) 00734 TimeoutData aData; 00735 aData.pTimeoutProc=pProc; 00736 aData.pData=pData; 00737 aData.bClearTimeout=bClearTimeout; 00738 aData.pTimer=pTimer; 00739 aData.pDeleteProc=pDeleteProc; 00740 00741 //Enter the CS 00742 CCriticalAutoRelease aRelease(m_pCSection); 00743 00744 //Do we have a handle 00745 if (hHandle) 00746 { 00747 //Get it 00748 iIndex=GetIndexByHWND(hHandle); 00749 00750 //Do we have it 00751 if (!iIndex) 00752 { 00753 //Report it 00754 ReportError("RegisterTimeout","Failed to find handle!"); 00755 00756 //Exit 00757 return aTimerID; 00758 } 00759 else 00760 --iIndex; 00761 } 00762 else 00763 { 00764 //Get the handler 00765 iIndex=GetMostAvailableThread(); 00766 00767 //Check it's legal 00768 if (!iIndex) 00769 { 00770 //Report the error 00771 ReportError("RegisterTimeout","Failed to find thread!"); 00772 00773 //Quit 00774 return aTimerID; 00775 } 00776 00777 //Reset the index 00778 --iIndex; 00779 } 00780 00781 //Our timer ID 00782 unsigned int iTimerID; 00783 iTimerID=0; 00784 00785 //Timer counter 00786 static int sTimerCounter=1000000; 00787 00788 //Get the timerID 00789 int iSetTimerID; 00790 iSetTimerID=sTimerCounter++; 00791 00792 //Lock the thread data 00793 CCriticalAutoRelease aRelease2(m_pThreadData[iIndex].pCSection); 00794 00795 //Increase the timeout count 00796 ++m_pThreadData[iIndex].iTimeoutCount; 00797 00798 //Register the data 00799 m_pThreadData[iIndex].pMap.insert(TOMap::value_type(iSetTimerID,aData)); 00800 00801 //Exit the CS 00802 aRelease2.Exit(); 00803 aRelease.Exit(); 00804 00805 //Register the timeout 00806 iTimerID=SetTimer(m_pThreadData[iIndex].hWindowHandle, 00807 iSetTimerID, 00808 iMS, 00809 NULL); 00810 00811 //Check we have the timer 00812 if (!iTimerID) 00813 { 00814 { 00815 //Remove it 00816 //Lock the thread data 00817 CCriticalAutoRelease aRelease2(m_pThreadData[iIndex].pCSection); 00818 00819 //Increase the timeout count 00820 --m_pThreadData[iIndex].iTimeoutCount; 00821 00822 //Register the data 00823 m_pThreadData[iIndex].pMap.erase(iSetTimerID); 00824 } 00825 00826 //Write the error 00827 ReportError("RegisterTimeout","Failed to create the timer!"); 00828 00829 //Quit 00830 return aTimerID; 00831 } 00832 00833 //Create the data 00834 aTimerID.iTimerID=iSetTimerID; 00835 aTimerID.iIndex=iIndex+1; 00836 aTimerID.iMS=iMS; 00837 00838 //Do we have a timer ? 00839 if (pTimer) 00840 memcpy(pTimer,&aTimerID,sizeof(aTimerID)); 00841 00842 //Done 00843 return aTimerID; 00844 } 00845 ERROR_HANDLER_RETURN("RegisterTimeout",aTimerID) 00846 }
Definition at line 330 of file SocketThreadManagerImp.cpp. 00331 { 00332 try 00333 { 00334 //Get the handle 00335 HWND hHandle; 00336 hHandle=pSocket->GetWindowHandle(); 00337 00338 //Do we have it 00339 if (!hHandle) 00340 { 00341 //Report it 00342 ReportError("RemoveSocket","Received socket without a handle!"); 00343 00344 //Exit 00345 return; 00346 } 00347 00348 //Find the thread data 00349 ThreadData* pData; 00350 pData=GetDataByHWND(hHandle); 00351 00352 //Do we have it 00353 if (!pData) 00354 //Report it 00355 ReportError("RemoveSocket","Failed to find thread data!"); 00356 else 00357 { 00358 //Get our extension 00359 ExtensionData* pExtension; 00360 pExtension=(ExtensionData*)pData->aExtension.lpData; 00361 00362 { 00363 //Lock the CS 00364 CCriticalAutoRelease aRelease(pExtension->pCSection); 00365 00366 //Remove from the map 00367 pExtension->aSocketsMap.erase(pSocket->GetAsyncHandle()); 00368 } 00369 00370 //Decrease socket count 00371 DecreaseSocketCount(hHandle, 00372 TRUE); 00373 } 00374 } 00375 ERROR_HANDLER("RemoveSocket") 00376 }
Definition at line 848 of file SocketThreadManager.cpp. 00850 { 00851 //Check it's a valid timeout 00852 if (!aTimerID.iIndex) 00853 { 00854 //Write the error 00855 ReportError("RemoveTimeout","Received invalid TimerID"); 00856 00857 //Quit 00858 return FALSE; 00859 } 00860 00861 try 00862 { 00863 //First unregister the timer 00864 if (!KillTimer(m_pThreadData[aTimerID.iIndex-1].hWindowHandle, 00865 aTimerID.iTimerID)) 00866 //Report it 00867 ReportErrorOS("RemoveTimeout","Failed to delete timer!"); 00868 00869 { 00870 //Lock the timeout manager 00871 CCriticalAutoRelease aRelease(m_pThreadData[aTimerID.iIndex-1].pCSection); 00872 00873 //Do we need to invoke the delete proc? 00874 if (!bInvokeDeleteProc) 00875 //No remove from the map 00876 m_pThreadData[aTimerID.iIndex-1].pMap.erase(aTimerID.iTimerID); 00877 else 00878 { 00879 //We need to look for the data 00880 TOMap::iterator aIterator; 00881 aIterator=m_pThreadData[aTimerID.iIndex-1].pMap.find(aTimerID.iTimerID); 00882 00883 //Do we have it? 00884 if (aIterator!=m_pThreadData[aTimerID.iIndex-1].pMap.end()) 00885 { 00886 //Do we have the delete proc? 00887 if (aIterator->second.pDeleteProc) 00888 //Invoke it 00889 (*aIterator->second.pDeleteProc)(aIterator->second.pData); 00890 00891 //Remove the entry 00892 m_pThreadData[aTimerID.iIndex-1].pMap.erase(aIterator); 00893 } 00894 else 00895 //Report it 00896 ReportError("RemoveTimeout","Failed to find data!"); 00897 } 00898 00899 //Decrease the count 00900 --m_pThreadData[aTimerID.iIndex-1].iTimeoutCount; 00901 00902 //Set the old timer ID 00903 aTimerID.iIndex=0; 00904 aTimerID.iMS=0; 00905 aTimerID.iTimerID=0; 00906 } 00907 00908 //Done 00909 return TRUE; 00910 } 00911 ERROR_HANDLER_RETURN("RemoveTimeout",FALSE) 00912 }
Definition at line 304 of file ErrorHandler.cpp. 00307 { 00308 if (!GetLog()) 00309 return; 00310 00311 try 00312 { 00313 //Convert the error code 00314 char aTmp[11]; 00315 sprintf(aTmp,"%d",iErrorCode); 00316 00317 //Get the string for it 00318 std::string sError; 00319 sError=rMessage; 00320 sError+=", and Socket error: "; 00321 sError+=aTmp; 00322 sError+=", "; 00323 sError+=ErrorCodeToString(iErrorCode); 00324 00325 //Report to the log 00326 WriteError(m_sClassName, 00327 rMethod, 00328 sError); 00329 } 00330 ERROR_UNKNOWN("ReportError") 00331 }
Definition at line 333 of file ErrorHandler.cpp. 00335 { 00336 if (!GetLog()) 00337 return; 00338 00339 try 00340 { 00341 //Convert the error code 00342 char aTmp[11]; 00343 sprintf(aTmp,"%d",iErrorCode); 00344 00345 //Get the string for it 00346 std::string sError; 00347 sError="Socket error: "; 00348 sError+=aTmp; 00349 sError+=", "; 00350 sError+=ErrorCodeToString(iErrorCode); 00351 00352 //Report to the log 00353 WriteError(m_sClassName, 00354 rMethod, 00355 sError); 00356 } 00357 ERROR_UNKNOWN("ReportError") 00358 }
Definition at line 461 of file ErrorHandler.cpp. 00464 { 00465 if (!GetLog()) 00466 return; 00467 00468 try 00469 { 00470 //Create the new message 00471 std::string sNewMessage(rMessage); 00472 sNewMessage+=", Additional data: "; 00473 sNewMessage+=rAdditionalData; 00474 00475 //Report to the log 00476 WriteError(m_sClassName, 00477 rMethod, 00478 sNewMessage); 00479 } 00480 ERROR_UNKNOWN("ReportError") 00481 }
Definition at line 483 of file ErrorHandler.cpp. 00486 { 00487 if (!GetLog()) 00488 return; 00489 00490 try 00491 { 00492 //Convert the number 00493 char aTmp[11]; 00494 ltoa(dwAdditionalData,aTmp,10); 00495 00496 //Create the new message 00497 std::string sNewMessage(rMessage); 00498 sNewMessage+=", Additional data: "; 00499 sNewMessage+=aTmp; 00500 00501 //Report to the log 00502 WriteError(m_sClassName, 00503 rMethod, 00504 sNewMessage); 00505 } 00506 ERROR_UNKNOWN("ReportError") 00507 }
Definition at line 376 of file ErrorHandler.cpp. 00378 { 00379 if (!GetLog()) 00380 return; 00381 00382 try 00383 { 00384 //Report to the log 00385 WriteError(m_sClassName, 00386 rMethod, 00387 rMessage); 00388 } 00389 ERROR_UNKNOWN("ReportError") 00390 }
Definition at line 515 of file ErrorHandler.cpp. 00516 { 00517 if (!GetLog()) 00518 return; 00519 00520 try 00521 { 00522 //Get the last error 00523 DWORD dwLastError; 00524 dwLastError=GetLastError(); 00525 00526 //Report the error 00527 WriteError(m_sClassName, 00528 rMethod, 00529 ErrorCodeToString(dwLastError)); 00530 } 00531 ERROR_UNKNOWN("ReportError") 00532 }
Definition at line 427 of file ErrorHandler.cpp. 00429 { 00430 if (!GetLog()) 00431 return; 00432 00433 try 00434 { 00435 //Get the last error 00436 DWORD dwLastError; 00437 dwLastError=GetLastError(); 00438 00439 //Format the message 00440 std::string sMessage; 00441 sMessage=rMessage; 00442 sMessage+=", with error code: "; 00443 00444 //Convert the error code 00445 char aTmp[11]; 00446 itoa(dwLastError,aTmp,10); 00447 00448 //Add it again 00449 sMessage+=aTmp; 00450 sMessage+=" "; 00451 sMessage+=ErrorCodeToString(dwLastError); 00452 00453 //Report to the log 00454 WriteError(m_sClassName, 00455 rMethod, 00456 sMessage); 00457 } 00458 ERROR_UNKNOWN("ReportErrorOS") 00459 }
Definition at line 590 of file ErrorHandler.cpp. 00594 { 00595 if (!m_pLog) 00596 return; 00597 00598 try 00599 { 00600 //Convert the number 00601 char aTmp[11]; 00602 ltoa(dwAdditionalData,aTmp,10); 00603 00604 //Create the new message 00605 std::string sNewMessage(rMessage); 00606 sNewMessage+=", Additional data: "; 00607 sNewMessage+=aTmp; 00608 00609 //Report to the log 00610 WriteStaticError(rClass, 00611 rMethod, 00612 sNewMessage); 00613 } 00614 ERROR_UNKNOWN("ReportStaticError") 00615 }
Definition at line 573 of file ErrorHandler.cpp. 00576 { 00577 if (!m_pLog) 00578 return; 00579 00580 try 00581 { 00582 //Report to the log 00583 WriteStaticError(rClass, 00584 rMethod, 00585 rMessage); 00586 } 00587 ERROR_UNKNOWN("ReportStaticError") 00588 }
Definition at line 553 of file ErrorHandler.cpp. 00555 { 00556 if (!m_pLog) 00557 return; 00558 00559 try 00560 { 00561 //Get the last error 00562 DWORD dwLastError; 00563 dwLastError=GetLastError(); 00564 00565 //Report the error 00566 WriteStaticError(rClass, 00567 rMethod, 00568 ErrorCodeToString(dwLastError)); 00569 } 00570 ERROR_UNKNOWN("ReportStaticError") 00571 }
Definition at line 392 of file ErrorHandler.cpp. 00395 { 00396 if (!m_pLog) 00397 return; 00398 00399 try 00400 { 00401 //Get the last error 00402 DWORD dwLastError; 00403 dwLastError=GetLastError(); 00404 00405 //Format the message 00406 std::string sMessage; 00407 sMessage=rMessage; 00408 sMessage+=", with error code: "; 00409 00410 //Convert the error code 00411 char aTmp[11]; 00412 itoa(dwLastError,aTmp,10); 00413 00414 //Add it again 00415 sMessage+=aTmp; 00416 sMessage+=" "; 00417 sMessage+=ErrorCodeToString(dwLastError); 00418 00419 //Report to the log 00420 WriteStaticError(rClass, 00421 rMethod, 00422 sMessage); 00423 } 00424 ERROR_UNKNOWN("ReportStaticError") 00425 }
Definition at line 965 of file SocketThreadManager.cpp. 00966 { 00967 //Check if anyone is smartass 00968 if (!rTimerID.iTimerID) 00969 { 00970 //Report it 00971 ReportError("ReSetTimeout","Someone send an empty TimerID!"); 00972 00973 //And exit 00974 return FALSE; 00975 } 00976 00977 try 00978 { 00979 //Reset the timer 00980 int iResult; 00981 iResult=SetTimer(m_pThreadData[rTimerID.iIndex-1].hWindowHandle, 00982 rTimerID.iTimerID, 00983 rTimerID.iMS, 00984 NULL); 00985 00986 //Check the result 00987 if (!iResult) 00988 ReportError("ReSetTimeout","Failed to reset the timeout!"); 00989 00990 //Done 00991 return iResult!=0; 00992 } 00993 ERROR_HANDLER_RETURN("ReSetTimeout",FALSE) 00994 }
Definition at line 543 of file ErrorHandler.cpp. 00545 { 00546 //Save the log 00547 m_pLocalLog=pLog; 00548 00549 //Save the write to main flag 00550 m_bWriteToMain=bWriteToMain; 00551 }
Definition at line 157 of file SocketThreadManager.cpp. 00158 { 00159 try 00160 { 00161 //Are we initialized? 00162 if (!m_bInitialized) 00163 return TRUE; 00164 00165 //Are we a static class 00166 if (m_bStaticClass) 00167 //Deallocate the class 00168 UnregisterClass(); 00169 else 00170 //Delete the thread data 00171 CleanThreads(FALSE); 00172 00173 //Unitialized 00174 m_bInitialized=FALSE; 00175 00176 //Done 00177 return TRUE; 00178 } 00179 ERROR_HANDLER_RETURN("Uninitialize",FALSE) 00180 }
Definition at line 168 of file ErrorHandler.cpp. 00171 { 00172 //Do we have a log? 00173 if (!GetLog()) 00174 return; 00175 00176 //Format the msg 00177 std::string sError; 00178 sError=FormatData(rClass, 00179 rMethod, 00180 rError); 00181 00182 //Write it 00183 GetLog()->WriteError(sError); 00184 00185 //Write to main 00186 if (m_bWriteToMain && 00187 m_pLog) 00188 //Write it 00189 m_pLog->WriteError(sError); 00190 }
Definition at line 360 of file ErrorHandler.cpp. 00362 { 00363 if (!GetLog()) 00364 return; 00365 00366 try 00367 { 00368 //Report to the log 00369 WriteMessage(m_sClassName, 00370 rMethod, 00371 rMessage); 00372 } 00373 ERROR_UNKNOWN("WriteMessage") 00374 }
Definition at line 226 of file ErrorHandler.cpp. 00229 { 00230 //Do we have a log? 00231 if (!GetLog()) 00232 return; 00233 00234 //Format the msg 00235 std::string sMsg; 00236 sMsg=FormatData(rClass, 00237 rMethod, 00238 rMessage, 00239 false); 00240 00241 //Write it 00242 GetLog()->WriteMessage(sMsg); 00243 00244 //Write to main 00245 if (m_bWriteToMain && 00246 m_pLog) 00247 //Write it 00248 m_pLog->WriteMessage(sMsg); 00249 }
Definition at line 192 of file ErrorHandler.cpp. 00195 { 00196 //Do we have a log? 00197 if (!m_pLog) 00198 return; 00199 00200 //Format the msg 00201 std::string sError; 00202 sError=FormatData(rClass, 00203 rMethod, 00204 rError); 00205 00206 //Write it 00207 m_pLog->WriteError(sError); 00208 }
Definition at line 210 of file ErrorHandler.cpp. 00213 { 00214 //Do we have a log? 00215 if (!m_pLog) 00216 return; 00217 00218 //Format the msg 00219 std::string sMsg; 00220 sMsg=FormatData(rClass, 00221 rMethod, 00222 rMessage, 00223 false); 00224 }
The documentation for this class was generated from the following files: |