Index: remoting/protocol/jingle_session.cc |
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc |
index 1b3c1a930448e986e406be8a3bda8af6c3ef9e63..5f5b6b5e40a7e67585ad3321c25cd0163e0908fe 100644 |
--- a/remoting/protocol/jingle_session.cc |
+++ b/remoting/protocol/jingle_session.cc |
@@ -7,11 +7,15 @@ |
#include "base/base64.h" |
#include "base/bind.h" |
#include "base/location.h" |
+#include "base/logging.h" |
#include "base/message_loop_proxy.h" |
#include "base/rand_util.h" |
#include "base/stl_util.h" |
#include "crypto/hmac.h" |
+#include "jingle/glue/utils.h" |
+#include "net/base/ip_endpoint.h" |
#include "net/base/net_errors.h" |
+#include "net/base/net_util.h" |
#include "net/socket/stream_socket.h" |
#include "remoting/base/constants.h" |
#include "remoting/protocol/auth_util.h" |
@@ -132,6 +136,12 @@ void JingleSession::SetStateChangeCallback( |
state_change_callback_ = callback; |
} |
+void JingleSession::SetRouteChangeCallback( |
+ const RouteChangeCallback& callback) { |
+ DCHECK(CalledOnValidThread()); |
+ route_change_callback_ = callback; |
+} |
+ |
Session::Error JingleSession::error() { |
DCHECK(CalledOnValidThread()); |
return error_; |
@@ -466,6 +476,8 @@ void JingleSession::AddChannelConnector( |
cricket::TransportChannel* raw_channel = |
cricket_session_->CreateChannel(content_name, name); |
+ raw_channel->SignalRouteChange.connect(this, &JingleSession::OnRouteChange); |
+ |
if (!jingle_session_manager_->allow_nat_traversal_ && |
!cricket_session_->initiator()) { |
// Don't make outgoing connections from the host to client when |
@@ -491,6 +503,19 @@ void JingleSession::OnChannelConnectorFinished( |
channel_connectors_.erase(name); |
} |
+void JingleSession::OnRouteChange(cricket::TransportChannel* channel, |
+ const cricket::Candidate& candidate) { |
+ net::IPEndPoint end_point; |
+ if (!jingle_glue::SocketAddressToIPEndPoint(candidate.address(), |
+ &end_point)) { |
+ NOTREACHED(); |
+ return; |
+ } |
+ |
+ if (!route_change_callback_.is_null()) |
+ route_change_callback_.Run(channel->name(), end_point); |
+} |
+ |
const cricket::ContentInfo* JingleSession::GetContentInfo() const { |
const cricket::SessionDescription* session_description; |
// If we initiate the session, we get to specify the content name. When |