![]() |
TimeoutProc() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Private Function |
Declared in: TCPPortScannerStealth.h |
Declaration
static BOOL TimeoutProc(
CPeriodicThread::ThreadStage aStage,
LPVOID pParam);
DescriptionOur periodic thread
Function Body
try
{
//Which stage are we
if (aStage!=CPeriodicThread::tsBody)
return TRUE;
//The class
CTCPPortScannerStealth* pClass;
pClass=(CTCPPortScannerStealth*)pParam;
//Which timeout do we use
unsigned long ulTimeout;
if (!(ulTimeout=pClass->GetConnectionTimeout()))
ulTimeout=SCAN_TIMEOUT;
//Our vector of ports
typedef std::vector<unsigned short> PortsVector;
PortsVector aVector;
{
//Our tick count
DWORD dwTick;
dwTick=GetTickCount();
//Lock
CCriticalAutoRelease aRelease(pClass->m_pCSection);
//Iterate the data
PortsMap::iterator aIterator;
aIterator=pClass->m_aPortsMap.begin();
while (aIterator!=pClass->m_aPortsMap.end() &&
!pClass->IsFinished())
{
//Check if passed it's time
if (dwTick-aIterator->second>=ulTimeout)
{
//Add to the vector
aVector.push_back(aIterator->first);
//Erase the data
aIterator=pClass->m_aPortsMap.erase(aIterator);
}
else
//Next
++aIterator;
}
}
//Start to shoot ports events
PortsVector::const_iterator aIterator;
aIterator=aVector.begin();
while (aIterator!=aVector.end() &&
!pClass->IsFinished())
{
//Shoot the event
pClass->SocketDone(*aIterator,
!pClass->m_bDefaultDisconnected);
//Next
++aIterator;
}
//Done
return TRUE;
}
ERROR_HANDLER_STATIC_RETURN(CTCPPortScannerStealth_Class,"TimeoutProc",FALSE)
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |