OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 return; | 278 return; |
279 } | 279 } |
280 | 280 |
281 if (login_backoff_.ShouldRejectRequest()) { | 281 if (login_backoff_.ShouldRejectRequest()) { |
282 LOG(WARNING) << "Rejecting connection due to" | 282 LOG(WARNING) << "Rejecting connection due to" |
283 " an overload of failed login attempts."; | 283 " an overload of failed login attempts."; |
284 *response = protocol::SessionManager::OVERLOAD; | 284 *response = protocol::SessionManager::OVERLOAD; |
285 return; | 285 return; |
286 } | 286 } |
287 | 287 |
288 scoped_ptr<protocol::SessionConfig> config = | 288 protocol::SessionConfig config; |
289 protocol::SessionConfig::SelectCommon(session->candidate_config(), | 289 if (!protocol_config_->Select(session->candidate_config(), &config)) { |
290 protocol_config_.get()); | |
291 if (!config) { | |
292 LOG(WARNING) << "Rejecting connection from " << session->jid() | 290 LOG(WARNING) << "Rejecting connection from " << session->jid() |
293 << " because no compatible configuration has been found."; | 291 << " because no compatible configuration has been found."; |
294 *response = protocol::SessionManager::INCOMPATIBLE; | 292 *response = protocol::SessionManager::INCOMPATIBLE; |
295 return; | 293 return; |
296 } | 294 } |
297 | 295 |
298 session->set_config(config.Pass()); | 296 session->set_config(config); |
299 | 297 |
300 *response = protocol::SessionManager::ACCEPT; | 298 *response = protocol::SessionManager::ACCEPT; |
301 | 299 |
302 HOST_LOG << "Client connected: " << session->jid(); | 300 HOST_LOG << "Client connected: " << session->jid(); |
303 | 301 |
304 // Create a client object. | 302 // Create a client object. |
305 scoped_ptr<protocol::ConnectionToClient> connection( | 303 scoped_ptr<protocol::ConnectionToClient> connection( |
306 new protocol::ConnectionToClient(session)); | 304 new protocol::ConnectionToClient(session)); |
307 ClientSession* client = new ClientSession( | 305 ClientSession* client = new ClientSession( |
308 this, | 306 this, |
(...skipping 24 matching lines...) Expand all Loading... |
333 DCHECK(CalledOnValidThread()); | 331 DCHECK(CalledOnValidThread()); |
334 | 332 |
335 while (!clients_.empty()) { | 333 while (!clients_.empty()) { |
336 size_t size = clients_.size(); | 334 size_t size = clients_.size(); |
337 clients_.front()->DisconnectSession(); | 335 clients_.front()->DisconnectSession(); |
338 CHECK_EQ(clients_.size(), size - 1); | 336 CHECK_EQ(clients_.size(), size - 1); |
339 } | 337 } |
340 } | 338 } |
341 | 339 |
342 } // namespace remoting | 340 } // namespace remoting |
OLD | NEW |