OLD | NEW |
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 Loading... |
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 |
OLD | NEW |