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

Side by Side Diff: webrtc/p2p/base/testturnserver.h

Issue 2114063002: Fixing memory leak in TurnServer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Using std::tie, added unit test. Created 4 years, 4 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/BUILD.gn ('k') | webrtc/p2p/base/turnserver.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 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 } 93 }
94 94
95 // Finds the first allocation in the server allocation map with a source 95 // Finds the first allocation in the server allocation map with a source
96 // ip and port matching the socket address provided. 96 // ip and port matching the socket address provided.
97 TurnServerAllocation* FindAllocation(const rtc::SocketAddress& src) { 97 TurnServerAllocation* FindAllocation(const rtc::SocketAddress& src) {
98 const TurnServer::AllocationMap& map = server_.allocations(); 98 const TurnServer::AllocationMap& map = server_.allocations();
99 for (TurnServer::AllocationMap::const_iterator it = map.begin(); 99 for (TurnServer::AllocationMap::const_iterator it = map.begin();
100 it != map.end(); ++it) { 100 it != map.end(); ++it) {
101 if (src == it->first.src()) { 101 if (src == it->first.src()) {
102 return it->second; 102 return it->second.get();
103 } 103 }
104 } 104 }
105 return NULL; 105 return NULL;
106 } 106 }
107 107
108 private: 108 private:
109 // For this test server, succeed if the password is the same as the username. 109 // For this test server, succeed if the password is the same as the username.
110 // Obviously, do not use this in a production environment. 110 // Obviously, do not use this in a production environment.
111 virtual bool GetKey(const std::string& username, const std::string& realm, 111 virtual bool GetKey(const std::string& username, const std::string& realm,
112 std::string* key) { 112 std::string* key) {
113 return ComputeStunCredentialHash(username, realm, username, key); 113 return ComputeStunCredentialHash(username, realm, username, key);
114 } 114 }
115 115
116 TurnServer server_; 116 TurnServer server_;
117 }; 117 };
118 118
119 } // namespace cricket 119 } // namespace cricket
120 120
121 #endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_ 121 #endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_
OLDNEW
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/p2p/base/turnserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698