Only redraw all clients once when the backoff timer expires rather than every

second all the time.

Reported by Simon Nicolussi.
pull/1/head
Nicholas Marriott 2009-09-05 17:42:16 +00:00
parent 83af55bed4
commit ffab22bb35
2 changed files with 5 additions and 3 deletions

View File

@ -233,8 +233,8 @@ server_unlock(const char *s)
return (0);
wrong:
password_backoff = server_activity;
password_failures++;
password_backoff = 0;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
@ -260,7 +260,8 @@ wrong:
}
failures = password_failures % tries;
if (failures > backoff) {
password_backoff += ((failures - backoff) * tries / 2);
password_backoff =
server_activity + ((failures - backoff) * tries / 2);
return (-2);
}
return (-1);

View File

@ -1210,11 +1210,12 @@ server_second_timers(void)
}
}
if (t > password_backoff) {
if (password_backoff != 0 && t >= password_backoff) {
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
if ((c = ARRAY_ITEM(&clients, i)) != NULL)
server_redraw_client(c);
}
password_backoff = 0;
}
/* Check for a minute having passed. */