void AbstractWebApplication::UnbanTimerEvent() { UnbanTimer* ubantimer = static_cast<UnbanTimer*>(sender()); qDebug("Ban period has expired for %s", qPrintable(ubantimer->peerIp().toString())); clientFailedAttempts_.remove(ubantimer->peerIp()); ubantimer->deleteLater(); }
void HttpServer::increaseNbFailedAttemptsForIp(const QString& ip) { const int nb_fail = m_clientFailedAttempts.value(ip, 0) + 1; m_clientFailedAttempts.insert(ip, nb_fail); if (nb_fail == MAX_AUTH_FAILED_ATTEMPTS) { // Max number of failed attempts reached // Start ban period UnbanTimer* ubantimer = new UnbanTimer(ip, this); connect(ubantimer, SIGNAL(timeout()), SLOT(UnbanTimerEvent())); ubantimer->start(); } }
void AbstractWebApplication::increaseFailedAttempts() { const int nb_fail = clientFailedAttempts_.value(env_.clientAddress, 0) + 1; clientFailedAttempts_[env_.clientAddress] = nb_fail; if (nb_fail == MAX_AUTH_FAILED_ATTEMPTS) { // Max number of failed attempts reached // Start ban period UnbanTimer* ubantimer = new UnbanTimer(env_.clientAddress, this); connect(ubantimer, SIGNAL(timeout()), SLOT(UnbanTimerEvent())); ubantimer->start(); } }
void HttpServer::UnbanTimerEvent() { UnbanTimer* ubantimer = static_cast<UnbanTimer*>(sender()); qDebug("Ban period has expired for %s", qPrintable(ubantimer->peerIp())); m_clientFailedAttempts.remove(ubantimer->peerIp()); ubantimer->deleteLater(); }