| 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/pepper_session.h" | 5 #include "remoting/protocol/pepper_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 break; | 277 break; |
| 278 | 278 |
| 279 default: | 279 default: |
| 280 LOG(WARNING) << "Received session-terminate message " | 280 LOG(WARNING) << "Received session-terminate message " |
| 281 "with an unexpected reason."; | 281 "with an unexpected reason."; |
| 282 OnError(SESSION_REJECTED); | 282 OnError(SESSION_REJECTED); |
| 283 } | 283 } |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 | 286 |
| 287 // TODO(sergeyu): We should return CHANNEL_CONNECTION_ERROR only in |
| 288 // case when |message.reason| is set GENERAL_ERROR, but some legacy |
| 289 // hosts may sent terminate messages with reason set to SUCCESS. |
| 290 if (state_ == CONNECTED) { |
| 291 // Session was connected, but we failed to connect channels. |
| 292 OnError(CHANNEL_CONNECTION_ERROR); |
| 293 return; |
| 294 } |
| 295 |
| 287 CloseInternal(false); | 296 CloseInternal(false); |
| 288 } | 297 } |
| 289 | 298 |
| 290 bool PepperSession::InitializeConfigFromDescription( | 299 bool PepperSession::InitializeConfigFromDescription( |
| 291 const ContentDescription* description) { | 300 const ContentDescription* description) { |
| 292 DCHECK(description); | 301 DCHECK(description); |
| 293 | 302 |
| 294 remote_cert_ = description->certificate(); | 303 remote_cert_ = description->certificate(); |
| 295 if (remote_cert_.empty()) { | 304 if (remote_cert_.empty()) { |
| 296 LOG(ERROR) << "session-accept does not specify certificate"; | 305 LOG(ERROR) << "session-accept does not specify certificate"; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 DCHECK_NE(state_, FAILED); | 410 DCHECK_NE(state_, FAILED); |
| 402 | 411 |
| 403 state_ = new_state; | 412 state_ = new_state; |
| 404 if (!state_change_callback_.is_null()) | 413 if (!state_change_callback_.is_null()) |
| 405 state_change_callback_.Run(new_state); | 414 state_change_callback_.Run(new_state); |
| 406 } | 415 } |
| 407 } | 416 } |
| 408 | 417 |
| 409 } // namespace protocol | 418 } // namespace protocol |
| 410 } // namespace remoting | 419 } // namespace remoting |
| OLD | NEW |