예제 #1
0
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();
  }
}
예제 #2
0
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();
    }
}