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(); | |
226 } | 224 } |
227 | 225 |
228 void StunRequest::OnSent() { | 226 void StunRequest::OnSent() { |
229 count_ += 1; | 227 count_ += 1; |
230 if (count_ == MAX_SENDS) | 228 if (count_ == MAX_SENDS) { |
231 timeout_ = true; | 229 timeout_ = true; |
| 230 } |
| 231 LOG(LS_VERBOSE) << "Sent STUN request " << count_ |
| 232 << "; resend delay = " << resend_delay(); |
232 } | 233 } |
233 | 234 |
234 int StunRequest::resend_delay() { | 235 int StunRequest::resend_delay() { |
235 if (count_ == 0) { | 236 if (count_ == 0) { |
236 return 0; | 237 return 0; |
237 } | 238 } |
238 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR); | 239 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR); |
239 } | 240 } |
240 | 241 |
241 } // namespace cricket | 242 } // namespace cricket |
OLD | NEW |