| 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/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Delete the request from the list of pending requests. | 316 // Delete the request from the list of pending requests. |
| 317 pending_requests_.erase(request); | 317 pending_requests_.erase(request); |
| 318 delete request; | 318 delete request; |
| 319 | 319 |
| 320 // |response| will be NULL if the request timed out. | 320 // |response| will be NULL if the request timed out. |
| 321 if (!response) { | 321 if (!response) { |
| 322 LOG(ERROR) << type_str << " request timed out."; | 322 LOG(ERROR) << type_str << " request timed out."; |
| 323 CloseInternal(SIGNALING_TIMEOUT); | 323 CloseInternal(SIGNALING_TIMEOUT); |
| 324 return; | 324 return; |
| 325 } else { | 325 } else { |
| 326 const std::string& type = response->Attr(buzz::QName("", "type")); | 326 const std::string& type = |
| 327 response->Attr(buzz::QName(std::string(), "type")); |
| 327 if (type != "result") { | 328 if (type != "result") { |
| 328 LOG(ERROR) << "Received error in response to " << type_str | 329 LOG(ERROR) << "Received error in response to " << type_str |
| 329 << " message: \"" << response->Str() | 330 << " message: \"" << response->Str() |
| 330 << "\". Terminating the session."; | 331 << "\". Terminating the session."; |
| 331 | 332 |
| 332 switch (request_type) { | 333 switch (request_type) { |
| 333 case JingleMessage::SESSION_INFO: | 334 case JingleMessage::SESSION_INFO: |
| 334 // session-info is used for the new authentication protocol, | 335 // session-info is used for the new authentication protocol, |
| 335 // and wasn't previously supported. | 336 // and wasn't previously supported. |
| 336 CloseInternal(INCOMPATIBLE_PROTOCOL); | 337 CloseInternal(INCOMPATIBLE_PROTOCOL); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 DCHECK_EQ(request, transport_info_requests_.front()); | 377 DCHECK_EQ(request, transport_info_requests_.front()); |
| 377 delete request; | 378 delete request; |
| 378 transport_info_requests_.pop_front(); | 379 transport_info_requests_.pop_front(); |
| 379 | 380 |
| 380 // Ignore transport-info timeouts. | 381 // Ignore transport-info timeouts. |
| 381 if (!response) { | 382 if (!response) { |
| 382 LOG(ERROR) << "transport-info request has timed out."; | 383 LOG(ERROR) << "transport-info request has timed out."; |
| 383 return; | 384 return; |
| 384 } | 385 } |
| 385 | 386 |
| 386 const std::string& type = response->Attr(buzz::QName("", "type")); | 387 const std::string& type = response->Attr(buzz::QName(std::string(), "type")); |
| 387 if (type != "result") { | 388 if (type != "result") { |
| 388 LOG(ERROR) << "Received error in response to transport-info message: \"" | 389 LOG(ERROR) << "Received error in response to transport-info message: \"" |
| 389 << response->Str() << "\". Terminating the session."; | 390 << response->Str() << "\". Terminating the session."; |
| 390 CloseInternal(PEER_IS_OFFLINE); | 391 CloseInternal(PEER_IS_OFFLINE); |
| 391 } | 392 } |
| 392 } | 393 } |
| 393 | 394 |
| 394 void JingleSession::OnIncomingMessage(const JingleMessage& message, | 395 void JingleSession::OnIncomingMessage(const JingleMessage& message, |
| 395 const ReplyCallback& reply_callback) { | 396 const ReplyCallback& reply_callback) { |
| 396 DCHECK(CalledOnValidThread()); | 397 DCHECK(CalledOnValidThread()); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 DCHECK_NE(state_, FAILED); | 623 DCHECK_NE(state_, FAILED); |
| 623 | 624 |
| 624 state_ = new_state; | 625 state_ = new_state; |
| 625 if (event_handler_) | 626 if (event_handler_) |
| 626 event_handler_->OnSessionStateChange(new_state); | 627 event_handler_->OnSessionStateChange(new_state); |
| 627 } | 628 } |
| 628 } | 629 } |
| 629 | 630 |
| 630 } // namespace protocol | 631 } // namespace protocol |
| 631 } // namespace remoting | 632 } // namespace remoting |
| OLD | NEW |