@ -165,7 +165,7 @@ bool RecvLine(SOCKET hSocket, string& strLine)
continue ;
continue ;
if ( nErr = = WSAEWOULDBLOCK | | nErr = = WSAEINTR | | nErr = = WSAEINPROGRESS )
if ( nErr = = WSAEWOULDBLOCK | | nErr = = WSAEINTR | | nErr = = WSAEINPROGRESS )
{
{
Sleep ( 10 ) ;
Milli Sleep( 10 ) ;
continue ;
continue ;
}
}
}
}
@ -909,7 +909,7 @@ void ThreadSocketHandler2(void* parg)
}
}
FD_ZERO ( & fdsetSend ) ;
FD_ZERO ( & fdsetSend ) ;
FD_ZERO ( & fdsetError ) ;
FD_ZERO ( & fdsetError ) ;
Sleep ( timeout . tv_usec / 1000 ) ;
Milli Sleep( timeout . tv_usec / 1000 ) ;
}
}
@ -1076,7 +1076,7 @@ void ThreadSocketHandler2(void* parg)
pnode - > Release ( ) ;
pnode - > Release ( ) ;
}
}
Sleep ( 10 ) ;
Milli Sleep( 10 ) ;
}
}
}
}
@ -1197,7 +1197,7 @@ void ThreadMapPort2(void* parg)
else
else
printf ( " UPnP Port Mapping successful. \n " ) ; ;
printf ( " UPnP Port Mapping successful. \n " ) ; ;
}
}
Sleep ( 2000 ) ;
Milli Sleep( 2000 ) ;
i + + ;
i + + ;
}
}
} else {
} else {
@ -1208,7 +1208,7 @@ void ThreadMapPort2(void* parg)
loop {
loop {
if ( fShutdown | | ! fUseUPnP )
if ( fShutdown | | ! fUseUPnP )
return ;
return ;
Sleep ( 2000 ) ;
Milli Sleep( 2000 ) ;
}
}
}
}
}
}
@ -1418,7 +1418,7 @@ void ThreadDumpAddress2(void* parg)
{
{
DumpAddresses ( ) ;
DumpAddresses ( ) ;
vnThreadsRunning [ THREAD_DUMPADDRESS ] - - ;
vnThreadsRunning [ THREAD_DUMPADDRESS ] - - ;
Sleep ( 100000 ) ;
Milli Sleep( 100000 ) ;
vnThreadsRunning [ THREAD_DUMPADDRESS ] + + ;
vnThreadsRunning [ THREAD_DUMPADDRESS ] + + ;
}
}
vnThreadsRunning [ THREAD_DUMPADDRESS ] - - ;
vnThreadsRunning [ THREAD_DUMPADDRESS ] - - ;
@ -1494,12 +1494,12 @@ void ThreadOpenConnections2(void* parg)
OpenNetworkConnection ( addr , NULL , strAddr . c_str ( ) ) ;
OpenNetworkConnection ( addr , NULL , strAddr . c_str ( ) ) ;
for ( int i = 0 ; i < 10 & & i < nLoop ; i + + )
for ( int i = 0 ; i < 10 & & i < nLoop ; i + + )
{
{
Sleep ( 500 ) ;
Milli Sleep( 500 ) ;
if ( fShutdown )
if ( fShutdown )
return ;
return ;
}
}
}
}
Sleep ( 500 ) ;
Milli Sleep( 500 ) ;
}
}
}
}
@ -1510,7 +1510,7 @@ void ThreadOpenConnections2(void* parg)
ProcessOneShot ( ) ;
ProcessOneShot ( ) ;
vnThreadsRunning [ THREAD_OPENCONNECTIONS ] - - ;
vnThreadsRunning [ THREAD_OPENCONNECTIONS ] - - ;
Sleep ( 500 ) ;
Milli Sleep( 500 ) ;
vnThreadsRunning [ THREAD_OPENCONNECTIONS ] + + ;
vnThreadsRunning [ THREAD_OPENCONNECTIONS ] + + ;
if ( fShutdown )
if ( fShutdown )
return ;
return ;
@ -1642,12 +1642,12 @@ void ThreadOpenAddedConnections2(void* parg)
CAddress addr ;
CAddress addr ;
CSemaphoreGrant grant ( * semOutbound ) ;
CSemaphoreGrant grant ( * semOutbound ) ;
OpenNetworkConnection ( addr , & grant , strAddNode . c_str ( ) ) ;
OpenNetworkConnection ( addr , & grant , strAddNode . c_str ( ) ) ;
Sleep ( 500 ) ;
Milli Sleep( 500 ) ;
if ( fShutdown )
if ( fShutdown )
return ;
return ;
}
}
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] - - ;
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] - - ;
Sleep ( 120000 ) ; // Retry every 2 minutes
Milli Sleep( 120000 ) ; // Retry every 2 minutes
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] + + ;
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] + + ;
}
}
return ;
return ;
@ -1694,14 +1694,14 @@ void ThreadOpenAddedConnections2(void* parg)
{
{
CSemaphoreGrant grant ( * semOutbound ) ;
CSemaphoreGrant grant ( * semOutbound ) ;
OpenNetworkConnection ( CAddress ( vserv [ i % vserv . size ( ) ] ) , & grant ) ;
OpenNetworkConnection ( CAddress ( vserv [ i % vserv . size ( ) ] ) , & grant ) ;
Sleep ( 500 ) ;
Milli Sleep( 500 ) ;
if ( fShutdown )
if ( fShutdown )
return ;
return ;
}
}
if ( fShutdown )
if ( fShutdown )
return ;
return ;
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] - - ;
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] - - ;
Sleep ( 120000 ) ; // Retry every 2 minutes
Milli Sleep( 120000 ) ; // Retry every 2 minutes
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] + + ;
vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] + + ;
if ( fShutdown )
if ( fShutdown )
return ;
return ;
@ -1821,7 +1821,7 @@ void ThreadMessageHandler2(void* parg)
// Reduce vnThreadsRunning so StopNode has permission to exit while
// Reduce vnThreadsRunning so StopNode has permission to exit while
// we're sleeping, but we must always check fShutdown after doing this.
// we're sleeping, but we must always check fShutdown after doing this.
vnThreadsRunning [ THREAD_MESSAGEHANDLER ] - - ;
vnThreadsRunning [ THREAD_MESSAGEHANDLER ] - - ;
Sleep ( 100 ) ;
Milli Sleep( 100 ) ;
if ( fRequestShutdown )
if ( fRequestShutdown )
StartShutdown ( ) ;
StartShutdown ( ) ;
vnThreadsRunning [ THREAD_MESSAGEHANDLER ] + + ;
vnThreadsRunning [ THREAD_MESSAGEHANDLER ] + + ;
@ -2068,7 +2068,7 @@ bool StopNode()
break ;
break ;
if ( GetTime ( ) - nStart > 20 )
if ( GetTime ( ) - nStart > 20 )
break ;
break ;
Sleep ( 20 ) ;
Milli Sleep( 20 ) ;
} while ( true ) ;
} while ( true ) ;
if ( vnThreadsRunning [ THREAD_SOCKETHANDLER ] > 0 ) printf ( " ThreadSocketHandler still running \n " ) ;
if ( vnThreadsRunning [ THREAD_SOCKETHANDLER ] > 0 ) printf ( " ThreadSocketHandler still running \n " ) ;
if ( vnThreadsRunning [ THREAD_OPENCONNECTIONS ] > 0 ) printf ( " ThreadOpenConnections still running \n " ) ;
if ( vnThreadsRunning [ THREAD_OPENCONNECTIONS ] > 0 ) printf ( " ThreadOpenConnections still running \n " ) ;
@ -2082,8 +2082,8 @@ bool StopNode()
if ( vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] > 0 ) printf ( " ThreadOpenAddedConnections still running \n " ) ;
if ( vnThreadsRunning [ THREAD_ADDEDCONNECTIONS ] > 0 ) printf ( " ThreadOpenAddedConnections still running \n " ) ;
if ( vnThreadsRunning [ THREAD_DUMPADDRESS ] > 0 ) printf ( " ThreadDumpAddresses still running \n " ) ;
if ( vnThreadsRunning [ THREAD_DUMPADDRESS ] > 0 ) printf ( " ThreadDumpAddresses still running \n " ) ;
while ( vnThreadsRunning [ THREAD_MESSAGEHANDLER ] > 0 | | vnThreadsRunning [ THREAD_RPCHANDLER ] > 0 )
while ( vnThreadsRunning [ THREAD_MESSAGEHANDLER ] > 0 | | vnThreadsRunning [ THREAD_RPCHANDLER ] > 0 )
Sleep ( 20 ) ;
Milli Sleep( 20 ) ;
Sleep ( 50 ) ;
Milli Sleep( 50 ) ;
DumpAddresses ( ) ;
DumpAddresses ( ) ;
return true ;
return true ;