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/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 void JingleSession::OnChannelConnectorFinished( | 501 void JingleSession::OnChannelConnectorFinished( |
502 const std::string& name, JingleChannelConnector* connector) { | 502 const std::string& name, JingleChannelConnector* connector) { |
503 DCHECK(CalledOnValidThread()); | 503 DCHECK(CalledOnValidThread()); |
504 DCHECK_EQ(channel_connectors_[name], connector); | 504 DCHECK_EQ(channel_connectors_[name], connector); |
505 channel_connectors_.erase(name); | 505 channel_connectors_.erase(name); |
506 } | 506 } |
507 | 507 |
508 void JingleSession::OnRouteChange(cricket::TransportChannel* channel, | 508 void JingleSession::OnRouteChange(cricket::TransportChannel* channel, |
509 const cricket::Candidate& candidate) { | 509 const cricket::Candidate& candidate) { |
510 net::IPEndPoint end_point; | 510 net::IPEndPoint remote_end_point; |
511 if (!jingle_glue::SocketAddressToIPEndPoint(candidate.address(), | 511 if (!jingle_glue::SocketAddressToIPEndPoint(candidate.address(), |
512 &end_point)) { | 512 &remote_end_point)) { |
| 513 NOTREACHED(); |
| 514 return; |
| 515 } |
| 516 |
| 517 DCHECK(channel->GetP2PChannel()); |
| 518 DCHECK(channel->GetP2PChannel()->best_connection()); |
| 519 const cricket::Candidate& local_candidate = |
| 520 channel->GetP2PChannel()->best_connection()->local_candidate(); |
| 521 net::IPEndPoint local_end_point; |
| 522 if (!jingle_glue::SocketAddressToIPEndPoint(local_candidate.address(), |
| 523 &local_end_point)) { |
513 NOTREACHED(); | 524 NOTREACHED(); |
514 return; | 525 return; |
515 } | 526 } |
516 | 527 |
517 if (!route_change_callback_.is_null()) | 528 if (!route_change_callback_.is_null()) |
518 route_change_callback_.Run(channel->name(), end_point); | 529 route_change_callback_.Run(channel->name(), remote_end_point, |
| 530 local_end_point); |
519 } | 531 } |
520 | 532 |
521 const cricket::ContentInfo* JingleSession::GetContentInfo() const { | 533 const cricket::ContentInfo* JingleSession::GetContentInfo() const { |
522 const cricket::SessionDescription* session_description; | 534 const cricket::SessionDescription* session_description; |
523 // If we initiate the session, we get to specify the content name. When | 535 // If we initiate the session, we get to specify the content name. When |
524 // accepting one, the remote end specifies it. | 536 // accepting one, the remote end specifies it. |
525 if (cricket_session_->initiator()) { | 537 if (cricket_session_->initiator()) { |
526 session_description = cricket_session_->local_description(); | 538 session_description = cricket_session_->local_description(); |
527 } else { | 539 } else { |
528 session_description = cricket_session_->remote_description(); | 540 session_description = cricket_session_->remote_description(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 scoped_ptr<cricket::SessionDescription> desc( | 578 scoped_ptr<cricket::SessionDescription> desc( |
567 new cricket::SessionDescription()); | 579 new cricket::SessionDescription()); |
568 desc->AddContent( | 580 desc->AddContent( |
569 ContentDescription::kChromotingContentName, kChromotingXmlNamespace, | 581 ContentDescription::kChromotingContentName, kChromotingXmlNamespace, |
570 new ContentDescription(config.Pass(), authenticator_message.Pass())); | 582 new ContentDescription(config.Pass(), authenticator_message.Pass())); |
571 return desc.Pass(); | 583 return desc.Pass(); |
572 } | 584 } |
573 | 585 |
574 } // namespace protocol | 586 } // namespace protocol |
575 } // namespace remoting | 587 } // namespace remoting |
OLD | NEW |