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 protocol::SessionConfig config; | 288 scoped_ptr<protocol::SessionConfig> config = |
289 if (!protocol_config_->Select(session->candidate_config(), &config)) { | 289 protocol::SessionConfig::SelectCommon(session->candidate_config(), |
| 290 protocol_config_.get()); |
| 291 if (!config) { |
290 LOG(WARNING) << "Rejecting connection from " << session->jid() | 292 LOG(WARNING) << "Rejecting connection from " << session->jid() |
291 << " because no compatible configuration has been found."; | 293 << " because no compatible configuration has been found."; |
292 *response = protocol::SessionManager::INCOMPATIBLE; | 294 *response = protocol::SessionManager::INCOMPATIBLE; |
293 return; | 295 return; |
294 } | 296 } |
295 | 297 |
296 session->set_config(config); | 298 session->set_config(config.Pass()); |
297 | 299 |
298 *response = protocol::SessionManager::ACCEPT; | 300 *response = protocol::SessionManager::ACCEPT; |
299 | 301 |
300 HOST_LOG << "Client connected: " << session->jid(); | 302 HOST_LOG << "Client connected: " << session->jid(); |
301 | 303 |
302 // Create a client object. | 304 // Create a client object. |
303 scoped_ptr<protocol::ConnectionToClient> connection( | 305 scoped_ptr<protocol::ConnectionToClient> connection( |
304 new protocol::ConnectionToClient(session)); | 306 new protocol::ConnectionToClient(session)); |
305 ClientSession* client = new ClientSession( | 307 ClientSession* client = new ClientSession( |
306 this, | 308 this, |
(...skipping 24 matching lines...) Expand all Loading... |
331 DCHECK(CalledOnValidThread()); | 333 DCHECK(CalledOnValidThread()); |
332 | 334 |
333 while (!clients_.empty()) { | 335 while (!clients_.empty()) { |
334 size_t size = clients_.size(); | 336 size_t size = clients_.size(); |
335 clients_.front()->DisconnectSession(); | 337 clients_.front()->DisconnectSession(); |
336 CHECK_EQ(clients_.size(), size - 1); | 338 CHECK_EQ(clients_.size(), size - 1); |
337 } | 339 } |
338 } | 340 } |
339 | 341 |
340 } // namespace remoting | 342 } // namespace remoting |
OLD | NEW |