Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: remoting/protocol/jingle_session.cc

Issue 9271026: Add JingleSession::OnRouteChange(), and pass IP endpoint information to a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/jingle_session.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 1b3c1a930448e986e406be8a3bda8af6c3ef9e63..feaebea2c685f23809c9c7bf805ae628a3c8581f 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,13 @@ void JingleSession::SetStateChangeCallback(
state_change_callback_ = callback;
}
+void JingleSession::SetRouteChangeCallback(
+ const RouteChangeCallback& callback) {
+ DCHECK(CalledOnValidThread());
+ DCHECK(!callback.is_null());
Sergey Ulanov 2012/01/23 20:33:37 I don't think we need this DCHECK. The caller may
Lambros 2012/01/24 19:50:50 Done.
+ route_change_callback_ = callback;
+}
+
Session::Error JingleSession::error() {
DCHECK(CalledOnValidThread());
return error_;
@@ -466,6 +477,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 +504,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

Powered by Google App Engine
This is Rietveld 408576698