コード例 #1
0
 /**
  * Registers the client and calculates the delay after unsuccessful logins.
  *
  * @param client client address
  * @return delay
  */
 public int block(final byte[] client) {
   synchronized (blocked) {
     int delay = blocked.value(client);
     delay = delay == -1 ? 1 : Math.min(delay, 1024) * 2;
     blocked.add(client, delay);
     return delay;
   }
 }
コード例 #2
0
 /**
  * Resets the login delay after successful login.
  *
  * @param client client address
  */
 public void unblock(final byte[] client) {
   synchronized (blocked) {
     blocked.delete(client);
   }
 }