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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 7289032: Remove SocketWrapper to expose the threading issues it masks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase once more. Created 9 years, 5 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/socket_wrapper.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 3b005d25d472e50db6039edf19a1cc472c731247..ad417ef8c957c4b13fb4705a747499c717937021 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -21,7 +21,6 @@
#include "net/socket/ssl_server_socket.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/jingle_session_manager.h"
-#include "remoting/protocol/socket_wrapper.h"
#include "third_party/libjingle/source/talk/base/thread.h"
#include "third_party/libjingle/source/talk/p2p/base/session.h"
#include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h"
@@ -188,42 +187,32 @@ void JingleSession::CloseInternal(int result, bool failed) {
if (!closed_ && !closing_) {
closing_ = true;
- if (control_channel_.get())
- control_channel_->Close(result);
+ // Inform the StateChangeCallback, so calling code knows not to touch any
+ // channels.
+ if (failed)
+ SetState(FAILED);
+ else
+ SetState(CLOSED);
+
+ // Now tear down the remoting channel resources.
+ control_channel_.reset();
control_socket_.reset();
control_ssl_socket_.reset();
- if (control_socket_wrapper_.get())
- control_socket_wrapper_->Disconnect();
-
- if (event_channel_.get())
- event_channel_->Close(result);
+ event_channel_.reset();
event_socket_.reset();
event_ssl_socket_.reset();
- if (event_socket_wrapper_.get())
- event_socket_wrapper_->Disconnect();
-
- if (video_channel_.get())
- video_channel_->Close(result);
+ video_channel_.reset();
video_socket_.reset();
video_ssl_socket_.reset();
- if (video_socket_wrapper_.get())
- video_socket_wrapper_->Disconnect();
-
- if (video_rtp_channel_.get())
- video_rtp_channel_->Close(result);
- if (video_rtcp_channel_.get())
- video_rtcp_channel_->Close(result);
+ video_rtp_channel_.reset();
+ video_rtcp_channel_.reset();
+ // Tear down the cricket session, including the cricket transport channels.
if (cricket_session_) {
cricket_session_->Terminate();
cricket_session_->SignalState.disconnect(this);
}
- if (failed)
- SetState(FAILED);
- else
- SetState(CLOSED);
-
closed_ = true;
}
cert_verifier_.reset();
@@ -255,18 +244,18 @@ void JingleSession::SetStateChangeCallback(StateChangeCallback* callback) {
net::Socket* JingleSession::control_channel() {
DCHECK(CalledOnValidThread());
- return control_socket_wrapper_.get();
+ return control_ssl_socket_.get();
}
net::Socket* JingleSession::event_channel() {
DCHECK(CalledOnValidThread());
- return event_socket_wrapper_.get();
+ return event_ssl_socket_.get();
}
// TODO(sergeyu): Remove this method after we switch to RTP.
net::Socket* JingleSession::video_channel() {
DCHECK(CalledOnValidThread());
- return video_socket_wrapper_.get();
+ return video_ssl_socket_.get();
}
net::Socket* JingleSession::video_rtp_channel() {
@@ -653,22 +642,9 @@ void JingleSession::OnSSLConnect(int result) {
return;
}
- if (control_ssl_socket_.get() && control_ssl_socket_->IsConnected()) {
- control_socket_wrapper_.reset(
- new SocketWrapper(control_ssl_socket_.release()));
- }
- if (event_ssl_socket_.get() && event_ssl_socket_->IsConnected()) {
- event_socket_wrapper_.reset(
- new SocketWrapper(event_ssl_socket_.release()));
- }
- if (video_ssl_socket_.get() && video_ssl_socket_->IsConnected()) {
- video_socket_wrapper_.reset(
- new SocketWrapper(video_ssl_socket_.release()));
- }
-
- if (event_socket_wrapper_.get() &&
- control_socket_wrapper_.get() &&
- video_socket_wrapper_.get()) {
+ if (event_ssl_socket_.get() && event_ssl_socket_->IsConnected() &&
+ control_ssl_socket_.get() && control_ssl_socket_->IsConnected() &&
+ video_ssl_socket_.get() && video_ssl_socket_->IsConnected()) {
SetState(CONNECTED);
}
}
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/socket_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698