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/protocol/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return INCOMPATIBLE_PROTOCOL; | 64 return INCOMPATIBLE_PROTOCOL; |
65 } | 65 } |
66 NOTREACHED(); | 66 NOTREACHED(); |
67 return UNKNOWN_ERROR; | 67 return UNKNOWN_ERROR; |
68 } | 68 } |
69 | 69 |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 JingleSession::JingleSession(JingleSessionManager* session_manager) | 72 JingleSession::JingleSession(JingleSessionManager* session_manager) |
73 : session_manager_(session_manager), | 73 : session_manager_(session_manager), |
74 event_handler_(NULL), | 74 event_handler_(nullptr), |
75 state_(INITIALIZING), | 75 state_(INITIALIZING), |
76 error_(OK), | 76 error_(OK), |
77 config_is_set_(false), | 77 config_is_set_(false), |
78 weak_factory_(this) { | 78 weak_factory_(this) { |
79 } | 79 } |
80 | 80 |
81 JingleSession::~JingleSession() { | 81 JingleSession::~JingleSession() { |
82 channel_multiplexer_.reset(); | 82 channel_multiplexer_.reset(); |
83 STLDeleteContainerPointers(pending_requests_.begin(), | 83 STLDeleteContainerPointers(pending_requests_.begin(), |
84 pending_requests_.end()); | 84 pending_requests_.end()); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // Delete the request from the list of pending requests. | 335 // Delete the request from the list of pending requests. |
336 pending_requests_.erase(request); | 336 pending_requests_.erase(request); |
337 delete request; | 337 delete request; |
338 | 338 |
339 // Ignore all responses after session was closed. | 339 // Ignore all responses after session was closed. |
340 if (state_ == CLOSED || state_ == FAILED) | 340 if (state_ == CLOSED || state_ == FAILED) |
341 return; | 341 return; |
342 | 342 |
343 std::string type_str = JingleMessage::GetActionName(request_type); | 343 std::string type_str = JingleMessage::GetActionName(request_type); |
344 | 344 |
345 // |response| will be NULL if the request timed out. | 345 // |response| will be nullptr if the request timed out. |
346 if (!response) { | 346 if (!response) { |
347 LOG(ERROR) << type_str << " request timed out."; | 347 LOG(ERROR) << type_str << " request timed out."; |
348 CloseInternal(SIGNALING_TIMEOUT); | 348 CloseInternal(SIGNALING_TIMEOUT); |
349 return; | 349 return; |
350 } else { | 350 } else { |
351 const std::string& type = | 351 const std::string& type = |
352 response->Attr(buzz::QName(std::string(), "type")); | 352 response->Attr(buzz::QName(std::string(), "type")); |
353 if (type != "result") { | 353 if (type != "result") { |
354 LOG(ERROR) << "Received error in response to " << type_str | 354 LOG(ERROR) << "Received error in response to " << type_str |
355 << " message: \"" << response->Str() | 355 << " message: \"" << response->Str() |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 bool JingleSession::is_session_active() { | 676 bool JingleSession::is_session_active() { |
677 return state_ == CONNECTING || state_ == ACCEPTING || state_ == CONNECTED || | 677 return state_ == CONNECTING || state_ == ACCEPTING || state_ == CONNECTED || |
678 state_ == AUTHENTICATING || state_ == AUTHENTICATED; | 678 state_ == AUTHENTICATING || state_ == AUTHENTICATED; |
679 } | 679 } |
680 | 680 |
681 } // namespace protocol | 681 } // namespace protocol |
682 } // namespace remoting | 682 } // namespace remoting |
OLD | NEW |