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

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

Issue 1547373002: Cease all future TURN requests when a TURN refresh request fails. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 11 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/stunrequest.h ('k') | webrtc/p2p/base/turnport.h » ('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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 request->set_origin(origin_); 46 request->set_origin(origin_);
47 request->Construct(); 47 request->Construct();
48 requests_[request->id()] = request; 48 requests_[request->id()] = request;
49 if (delay > 0) { 49 if (delay > 0) {
50 thread_->PostDelayed(delay, request, MSG_STUN_SEND, NULL); 50 thread_->PostDelayed(delay, request, MSG_STUN_SEND, NULL);
51 } else { 51 } else {
52 thread_->Send(request, MSG_STUN_SEND, NULL); 52 thread_->Send(request, MSG_STUN_SEND, NULL);
53 } 53 }
54 } 54 }
55 55
56 void StunRequestManager::Flush() { 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 thread_->Clear(request, MSG_STUN_SEND); 59 if (msg_type == kAllRequests || msg_type == request->type()) {
60 thread_->Send(request, MSG_STUN_SEND, NULL); 60 thread_->Clear(request, MSG_STUN_SEND);
61 thread_->Send(request, MSG_STUN_SEND, NULL);
62 }
61 } 63 }
62 } 64 }
63 65
64 void StunRequestManager::Remove(StunRequest* request) { 66 void StunRequestManager::Remove(StunRequest* request) {
65 ASSERT(request->manager() == this); 67 ASSERT(request->manager() == this);
66 RequestMap::iterator iter = requests_.find(request->id()); 68 RequestMap::iterator iter = requests_.find(request->id());
67 if (iter != requests_.end()) { 69 if (iter != requests_.end()) {
68 ASSERT(iter->second == request); 70 ASSERT(iter->second == request);
69 requests_.erase(iter); 71 requests_.erase(iter);
70 thread_->Clear(request); 72 thread_->Clear(request);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 218 }
217 219
218 int StunRequest::resend_delay() { 220 int StunRequest::resend_delay() {
219 if (count_ == 0) { 221 if (count_ == 0) {
220 return 0; 222 return 0;
221 } 223 }
222 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR); 224 return DELAY_UNIT * std::min(1 << (count_-1), DELAY_MAX_FACTOR);
223 } 225 }
224 226
225 } // namespace cricket 227 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/stunrequest.h ('k') | webrtc/p2p/base/turnport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698