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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 void StunRequestManager::Flush(int msg_type) { | 56 void StunRequestManager::Flush(int msg_type) { |
57 for (const auto kv : requests_) { | 57 for (const auto kv : requests_) { |
58 StunRequest* request = kv.second; | 58 StunRequest* request = kv.second; |
59 if (msg_type == kAllRequests || msg_type == request->type()) { | 59 if (msg_type == kAllRequests || msg_type == request->type()) { |
60 thread_->Clear(request, MSG_STUN_SEND); | 60 thread_->Clear(request, MSG_STUN_SEND); |
61 thread_->Send(request, MSG_STUN_SEND, NULL); | 61 thread_->Send(request, MSG_STUN_SEND, NULL); |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 bool StunRequestManager::Exist(int msg_type) { | |
pthatcher1
2016/03/02 20:25:59
I think HasAny might be a better name.
honghaiz3
2016/03/02 23:22:51
Done. using HasRequest
| |
67 for (const auto kv : requests_) { | |
68 StunRequest* request = kv.second; | |
69 if (msg_type == kAllRequests || msg_type == request->type()) { | |
70 return true; | |
71 } | |
72 } | |
73 return false; | |
74 } | |
75 | |
66 void StunRequestManager::Remove(StunRequest* request) { | 76 void StunRequestManager::Remove(StunRequest* request) { |
67 ASSERT(request->manager() == this); | 77 ASSERT(request->manager() == this); |
68 RequestMap::iterator iter = requests_.find(request->id()); | 78 RequestMap::iterator iter = requests_.find(request->id()); |
69 if (iter != requests_.end()) { | 79 if (iter != requests_.end()) { |
70 ASSERT(iter->second == request); | 80 ASSERT(iter->second == request); |
71 requests_.erase(iter); | 81 requests_.erase(iter); |
72 thread_->Clear(request); | 82 thread_->Clear(request); |
73 } | 83 } |
74 } | 84 } |
75 | 85 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 } | 228 } |
219 | 229 |
220 int StunRequest::resend_delay() { | 230 int StunRequest::resend_delay() { |
221 if (count_ == 0) { | 231 if (count_ == 0) { |
222 return 0; | 232 return 0; |
223 } | 233 } |
224 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR); | 234 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR); |
225 } | 235 } |
226 | 236 |
227 } // namespace cricket | 237 } // namespace cricket |
OLD | NEW |