+void ChromotingHost::OnSessionAuthenticating(ClientSession* client) {
+ // We treat each incoming connection as a failure to authenticate,
+ // and clear the backoff when a connection successfully
+ // authenticates. This allows the backoff to protect from parallel
+ // connection attempts as well as sequential ones.
+ if (login_backoff_.ShouldRejectRequest()) {
+ LOG(WARNING) << "Disconnecting client " << client->client_jid() << " due to"
+ " an overload of failed login attempts.";
+ client->DisconnectSession();
+ return;
+ }
+ login_backoff_.InformOfRequest(false);
+}
+