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

Side by Side Diff: webrtc/p2p/base/stunrequest.cc

Issue 2001093003: Attempting to fix flaky tests that deal with STUN timeout. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 | « webrtc/p2p/base/stunport_unittest.cc ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 tstamp_ = rtc::TimeMillis(); 216 tstamp_ = rtc::TimeMillis();
217 217
218 rtc::ByteBufferWriter buf; 218 rtc::ByteBufferWriter buf;
219 msg_->Write(&buf); 219 msg_->Write(&buf);
220 manager_->SignalSendPacket(buf.Data(), buf.Length(), this); 220 manager_->SignalSendPacket(buf.Data(), buf.Length(), this);
221 221
222 OnSent(); 222 OnSent();
223 manager_->thread_->PostDelayed(resend_delay(), this, MSG_STUN_SEND, NULL); 223 manager_->thread_->PostDelayed(resend_delay(), this, MSG_STUN_SEND, NULL);
224 LOG(LS_INFO) << "Sent STUN request " << count_
225 << "; resend delay = " << resend_delay();
224 } 226 }
225 227
226 void StunRequest::OnSent() { 228 void StunRequest::OnSent() {
227 count_ += 1; 229 count_ += 1;
228 if (count_ == MAX_SENDS) 230 if (count_ == MAX_SENDS)
229 timeout_ = true; 231 timeout_ = true;
230 } 232 }
231 233
232 int StunRequest::resend_delay() { 234 int StunRequest::resend_delay() {
233 if (count_ == 0) { 235 if (count_ == 0) {
234 return 0; 236 return 0;
235 } 237 }
236 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR); 238 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR);
237 } 239 }
238 240
239 } // namespace cricket 241 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/stunport_unittest.cc ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698