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

Side by Side Diff: webrtc/p2p/base/fakeicetransport.h

Issue 2970883005: Handle case where UDP packet contains multiple DTLS records. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2017 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 rtc::Optional<int> GetRttEstimate() override { 154 rtc::Optional<int> GetRttEstimate() override {
155 return rtc::Optional<int>(); 155 return rtc::Optional<int>();
156 } 156 }
157 157
158 void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override { 158 void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override {
159 } 159 }
160 160
161 // Fake PacketTransportInternal implementation. 161 // Fake PacketTransportInternal implementation.
162 bool writable() const override { return writable_; } 162 bool writable() const override { return writable_; }
163 bool receiving() const override { return receiving_; } 163 bool receiving() const override { return receiving_; }
164 // If combine is enabled, two incoming packets will be combined into one
Taylor Brandstetter 2017/07/06 22:06:11 This comment is a little misleading, since all the
joachim 2017/07/07 16:13:00 Changed.
165 // outgoing packet.
166 void set_combine(bool combine) { combine_ = combine; }
Taylor Brandstetter 2017/07/06 22:06:11 nit: Making this name more descriptive, like "comb
joachim 2017/07/07 16:13:00 Done.
164 int SendPacket(const char* data, 167 int SendPacket(const char* data,
165 size_t len, 168 size_t len,
166 const rtc::PacketOptions& options, 169 const rtc::PacketOptions& options,
167 int flags) override { 170 int flags) override {
168 if (!dest_) { 171 if (!dest_) {
169 return -1; 172 return -1;
170 } 173 }
171 rtc::CopyOnWriteBuffer packet(data, len); 174
172 if (async_) { 175 send_packet_.AppendData(data, len);
173 invoker_.AsyncInvokeDelayed<void>( 176 if (!combine_ || send_packet_.size() > len) {
174 RTC_FROM_HERE, rtc::Thread::Current(), 177 rtc::CopyOnWriteBuffer packet(std::move(send_packet_));
175 rtc::Bind(&FakeIceTransport::SendPacketInternal, this, packet), 178 if (async_) {
176 async_delay_ms_); 179 invoker_.AsyncInvokeDelayed<void>(
177 } else { 180 RTC_FROM_HERE, rtc::Thread::Current(),
178 SendPacketInternal(packet); 181 rtc::Bind(&FakeIceTransport::SendPacketInternal, this, packet),
182 async_delay_ms_);
183 } else {
184 SendPacketInternal(packet);
185 }
179 } 186 }
180 rtc::SentPacket sent_packet(options.packet_id, rtc::TimeMillis()); 187 rtc::SentPacket sent_packet(options.packet_id, rtc::TimeMillis());
181 SignalSentPacket(this, sent_packet); 188 SignalSentPacket(this, sent_packet);
182 return static_cast<int>(len); 189 return static_cast<int>(len);
183 } 190 }
184 int SetOption(rtc::Socket::Option opt, int value) override { return true; } 191 int SetOption(rtc::Socket::Option opt, int value) override { return true; }
185 bool GetOption(rtc::Socket::Option opt, int* value) override { return true; } 192 bool GetOption(rtc::Socket::Option opt, int* value) override { return true; }
186 int GetError() override { return 0; } 193 int GetError() override { return 0; }
187 194
188 private: 195 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 std::string ice_ufrag_; 233 std::string ice_ufrag_;
227 std::string ice_pwd_; 234 std::string ice_pwd_;
228 std::string remote_ice_ufrag_; 235 std::string remote_ice_ufrag_;
229 std::string remote_ice_pwd_; 236 std::string remote_ice_pwd_;
230 IceMode remote_ice_mode_ = ICEMODE_FULL; 237 IceMode remote_ice_mode_ = ICEMODE_FULL;
231 size_t connection_count_ = 0; 238 size_t connection_count_ = 0;
232 IceGatheringState gathering_state_ = kIceGatheringNew; 239 IceGatheringState gathering_state_ = kIceGatheringNew;
233 bool had_connection_ = false; 240 bool had_connection_ = false;
234 bool writable_ = false; 241 bool writable_ = false;
235 bool receiving_ = false; 242 bool receiving_ = false;
243 bool combine_ = false;
244 rtc::CopyOnWriteBuffer send_packet_;
236 }; 245 };
237 246
238 } // namespace cricket 247 } // namespace cricket
239 248
240 #endif // WEBRTC_P2P_BASE_FAKEICETRANSPORT_H_ 249 #endif // WEBRTC_P2P_BASE_FAKEICETRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698