OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "crypto/hmac.h" | 9 #include "crypto/hmac.h" |
10 #include "crypto/rsa_private_key.h" | 10 #include "crypto/rsa_private_key.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (local_private_key) { | 152 if (local_private_key) { |
153 std::vector<uint8> key_bytes; | 153 std::vector<uint8> key_bytes; |
154 CHECK(local_private_key->ExportPrivateKey(&key_bytes)); | 154 CHECK(local_private_key->ExportPrivateKey(&key_bytes)); |
155 local_private_key_.reset( | 155 local_private_key_.reset( |
156 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); | 156 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); |
157 CHECK(local_private_key_.get()); | 157 CHECK(local_private_key_.get()); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 JingleSession::~JingleSession() { | 161 JingleSession::~JingleSession() { |
162 DCHECK(closed_); | 162 // Reset the callback so that it's not called from Close(). |
| 163 state_change_callback_.reset(); |
| 164 Close(); |
163 jingle_session_manager_->SessionDestroyed(this); | 165 jingle_session_manager_->SessionDestroyed(this); |
164 } | 166 } |
165 | 167 |
166 void JingleSession::Init(cricket::Session* cricket_session) { | 168 void JingleSession::Init(cricket::Session* cricket_session) { |
167 DCHECK(CalledOnValidThread()); | 169 DCHECK(CalledOnValidThread()); |
168 | 170 |
169 cricket_session_ = cricket_session; | 171 cricket_session_ = cricket_session; |
170 jid_ = cricket_session_->remote_name(); | 172 jid_ = cricket_session_->remote_name(); |
171 cert_verifier_.reset(new net::CertVerifier()); | 173 cert_verifier_.reset(new net::CertVerifier()); |
172 cricket_session_->SignalState.connect( | 174 cricket_session_->SignalState.connect( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 video_socket_.reset(); | 207 video_socket_.reset(); |
206 video_ssl_socket_.reset(); | 208 video_ssl_socket_.reset(); |
207 if (video_socket_wrapper_.get()) | 209 if (video_socket_wrapper_.get()) |
208 video_socket_wrapper_->Disconnect(); | 210 video_socket_wrapper_->Disconnect(); |
209 | 211 |
210 if (video_rtp_channel_.get()) | 212 if (video_rtp_channel_.get()) |
211 video_rtp_channel_->Close(result); | 213 video_rtp_channel_->Close(result); |
212 if (video_rtcp_channel_.get()) | 214 if (video_rtcp_channel_.get()) |
213 video_rtcp_channel_->Close(result); | 215 video_rtcp_channel_->Close(result); |
214 | 216 |
215 if (cricket_session_) | 217 if (cricket_session_) { |
216 cricket_session_->Terminate(); | 218 cricket_session_->Terminate(); |
| 219 cricket_session_->SignalState.disconnect(this); |
| 220 cricket_session_ = NULL; |
| 221 } |
217 | 222 |
218 if (failed) | 223 if (failed) |
219 SetState(FAILED); | 224 SetState(FAILED); |
220 else | 225 else |
221 SetState(CLOSED); | 226 SetState(CLOSED); |
222 | 227 |
223 closed_ = true; | 228 closed_ = true; |
224 } | 229 } |
225 cert_verifier_.reset(); | 230 cert_verifier_.reset(); |
226 } | 231 } |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 679 |
675 state_ = new_state; | 680 state_ = new_state; |
676 if (!closed_ && state_change_callback_.get()) | 681 if (!closed_ && state_change_callback_.get()) |
677 state_change_callback_->Run(new_state); | 682 state_change_callback_->Run(new_state); |
678 } | 683 } |
679 } | 684 } |
680 | 685 |
681 } // namespace protocol | 686 } // namespace protocol |
682 | 687 |
683 } // namespace remoting | 688 } // namespace remoting |
OLD | NEW |