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

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: Rebase and fix nits. 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
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/pepper_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/pepper_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698