mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
setup to only call time() if a cron is actually in use, also fix copy.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@788 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
15
Csocket.cpp
15
Csocket.cpp
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 1999-2006 Jim Hull <imaginos@imaginos.net>
|
||||
* Copyright (c) 1999-2007 Jim Hull <imaginos@imaginos.net>
|
||||
* All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -303,11 +303,14 @@ CCron::CCron()
|
||||
m_bPause = false;
|
||||
}
|
||||
|
||||
void CCron::run( time_t iNow )
|
||||
void CCron::run( time_t & iNow )
|
||||
{
|
||||
if ( m_bPause )
|
||||
return;
|
||||
|
||||
if( iNow == 0 )
|
||||
iNow = time( NULL );
|
||||
|
||||
if ( ( m_bActive ) && ( iNow >= m_iTime ) )
|
||||
{
|
||||
RunJob();
|
||||
@@ -988,10 +991,13 @@ bool Csock::ConnectSSL( const CS_STRING & sBindhost )
|
||||
#endif /* HAVE_LIBSSL */
|
||||
}
|
||||
|
||||
bool Csock::AllowWrite( unsigned long long iNOW ) const
|
||||
bool Csock::AllowWrite( unsigned long long & iNOW ) const
|
||||
{
|
||||
if ( ( m_iMaxBytes > 0 ) && ( m_iMaxMilliSeconds > 0 ) )
|
||||
{
|
||||
if( iNOW == 0 )
|
||||
iNOW = millitime();
|
||||
|
||||
if( m_iLastSend < m_iMaxBytes )
|
||||
return( true ); // allow sending if our out buffer was less than what we can send
|
||||
if ( ( iNOW - m_iLastSendTime ) < m_iMaxMilliSeconds )
|
||||
@@ -1657,7 +1663,8 @@ unsigned long long Csock::GetRateTime() { return( m_iMaxMilliSeconds ); }
|
||||
|
||||
void Csock::Cron()
|
||||
{
|
||||
time_t iNow = time( NULL );
|
||||
time_t iNow = 0;
|
||||
|
||||
for( vector<CCron *>::size_type a = 0; a < m_vcCrons.size(); a++ )
|
||||
{
|
||||
CCron *pcCron = m_vcCrons[a];
|
||||
|
||||
Reference in New Issue
Block a user