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

Side by Side Diff: remoting/protocol/fake_session.cc

Issue 2757723002: Update ICE protocol to handle closed channel (Closed)
Patch Set: . Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/connection_tester.cc ('k') | remoting/protocol/fake_stream_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/fake_session.h" 5 #include "remoting/protocol/fake_session.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void FakeSession::SetTransport(Transport* transport) { 71 void FakeSession::SetTransport(Transport* transport) {
72 transport_ = transport; 72 transport_ = transport;
73 } 73 }
74 74
75 void FakeSession::Close(ErrorCode error) { 75 void FakeSession::Close(ErrorCode error) {
76 closed_ = true; 76 closed_ = true;
77 error_ = error; 77 error_ = error;
78 event_handler_->OnSessionStateChange(CLOSED); 78 event_handler_->OnSessionStateChange(CLOSED);
79 79
80 FakeSession* peer = peer_.get(); 80 base::WeakPtr<FakeSession> peer = peer_;
81 if (peer) { 81 if (peer) {
82 peer->peer_.reset(); 82 peer->peer_.reset();
83 peer_.reset(); 83 peer_.reset();
84 peer->Close(error); 84
85 if (signaling_delay_.is_zero()) {
86 peer->Close(error);
87 } else {
88 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
89 FROM_HERE, base::Bind(&FakeSession::Close, peer, error),
90 signaling_delay_);
91 }
85 } 92 }
86 } 93 }
87 94
88 void FakeSession::SendTransportInfo( 95 void FakeSession::SendTransportInfo(
89 std::unique_ptr<buzz::XmlElement> transport_info) { 96 std::unique_ptr<buzz::XmlElement> transport_info) {
90 if (!peer_) 97 if (!peer_)
91 return; 98 return;
92 99
93 if (signaling_delay_.is_zero()) { 100 if (signaling_delay_.is_zero()) {
94 peer_->ProcessTransportInfo(std::move(transport_info)); 101 peer_->ProcessTransportInfo(std::move(transport_info));
(...skipping 25 matching lines...) Expand all
120 void FakeSession::SetAttachment(size_t round, 127 void FakeSession::SetAttachment(size_t round,
121 std::unique_ptr<buzz::XmlElement> attachment) { 128 std::unique_ptr<buzz::XmlElement> attachment) {
122 while (attachments_.size() <= round) { 129 while (attachments_.size() <= round) {
123 attachments_.emplace_back(); 130 attachments_.emplace_back();
124 } 131 }
125 attachments_[round] = std::move(attachment); 132 attachments_[round] = std::move(attachment);
126 } 133 }
127 134
128 } // namespace protocol 135 } // namespace protocol
129 } // namespace remoting 136 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_tester.cc ('k') | remoting/protocol/fake_stream_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698