mirror of
https://github.com/znc/znc.git
synced 2026-08-05 00:13:22 +02:00
Allow the connection queue to be paused
This commit is contained in:
@@ -161,6 +161,9 @@ public:
|
||||
void EnableConnectQueue();
|
||||
void DisableConnectQueue();
|
||||
|
||||
void PauseConnectQueue();
|
||||
void ResumeConnectQueue();
|
||||
|
||||
// Never call this unless you are CConnectQueueTimer::~CConnectQueueTimer()
|
||||
void LeakConnectQueueTimer(CConnectQueueTimer *pTimer);
|
||||
|
||||
@@ -205,6 +208,7 @@ protected:
|
||||
unsigned long long m_uBytesWritten;
|
||||
list<CIRCNetwork*> m_lpConnectQueue;
|
||||
CConnectQueueTimer *m_pConnectQueueTimer;
|
||||
unsigned int m_uiConnectPaused;
|
||||
TCacheMap<CString> m_sConnectThrottle;
|
||||
bool m_bProtectWebSessions;
|
||||
};
|
||||
|
||||
+13
-1
@@ -1868,7 +1868,7 @@ void CZNC::SetConnectDelay(unsigned int i) {
|
||||
}
|
||||
|
||||
void CZNC::EnableConnectQueue() {
|
||||
if (!m_pConnectQueueTimer) {
|
||||
if (!m_pConnectQueueTimer && !m_uiConnectPaused && !m_lpConnectQueue.empty()) {
|
||||
m_pConnectQueueTimer = new CConnectQueueTimer(m_uiConnectDelay);
|
||||
GetManager().AddCron(m_pConnectQueueTimer);
|
||||
}
|
||||
@@ -1882,6 +1882,18 @@ void CZNC::DisableConnectQueue() {
|
||||
}
|
||||
}
|
||||
|
||||
void CZNC::PauseConnectQueue() {
|
||||
DEBUG("Connection queue paused");
|
||||
m_uiConnectPaused++;
|
||||
DisableConnectQueue();
|
||||
}
|
||||
|
||||
void CZNC::ResumeConnectQueue() {
|
||||
DEBUG("Connection queue resumed");
|
||||
m_uiConnectPaused--;
|
||||
EnableConnectQueue();
|
||||
}
|
||||
|
||||
void CZNC::AddNetworkToQueue(CIRCNetwork *pNetwork) {
|
||||
// Make sure we are not already in the queue
|
||||
for (list<CIRCNetwork*>::const_iterator it = m_lpConnectQueue.begin(); it != m_lpConnectQueue.end(); ++it) {
|
||||
|
||||
Reference in New Issue
Block a user