Index: remoting/host/chromoting_host.cc |
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc |
index e4bdae75990a3a93c2c1ac8229ee2ceb544ee95b..572cfb7ab6a6bd03a369b4d5aec1bfbe9b2f3021 100644 |
--- a/remoting/host/chromoting_host.cc |
+++ b/remoting/host/chromoting_host.cc |
@@ -171,6 +171,20 @@ void ChromotingHost::SetMaximumSessionDuration( |
//////////////////////////////////////////////////////////////////////////// |
// protocol::ClientSession::EventHandler implementation. |
+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 due to" |
+ " an overload of failed login attempts."; |
+ client->DisconnectSession(); |
+ return; |
+ } |
+ login_backoff_.InformOfRequest(false); |
+} |
+ |
bool ChromotingHost::OnSessionAuthenticated(ClientSession* client) { |
DCHECK(CalledOnValidThread()); |
@@ -265,16 +279,12 @@ void ChromotingHost::OnIncomingSession( |
} |
if (login_backoff_.ShouldRejectRequest()) { |
+ LOG(WARNING) << "Rejecting connection due to" |
+ " an overload of failed login attempts."; |
Sergey Ulanov
2014/04/02 19:49:26
Please log session->jid() here.
kelvinp
2014/04/07 18:48:01
Done.
|
*response = protocol::SessionManager::OVERLOAD; |
return; |
} |
- // 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. |
- login_backoff_.InformOfRequest(false); |
- |
protocol::SessionConfig config; |
if (!protocol_config_->Select(session->candidate_config(), &config)) { |
LOG(WARNING) << "Rejecting connection from " << session->jid() |