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

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

Issue 1426673007: Do not delete the turn port entry right away when the respective connection is deleted. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | webrtc/p2p/base/turnport.cc » ('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
11 #ifndef WEBRTC_P2P_BASE_TURNPORT_H_ 11 #ifndef WEBRTC_P2P_BASE_TURNPORT_H_
12 #define WEBRTC_P2P_BASE_TURNPORT_H_ 12 #define WEBRTC_P2P_BASE_TURNPORT_H_
13 13
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <list> 15 #include <list>
16 #include <set> 16 #include <set>
17 #include <string> 17 #include <string>
18 18
19 #include "webrtc/base/asyncinvoker.h"
20 #include "webrtc/base/asyncpacketsocket.h"
19 #include "webrtc/p2p/base/port.h" 21 #include "webrtc/p2p/base/port.h"
20 #include "webrtc/p2p/client/basicportallocator.h" 22 #include "webrtc/p2p/client/basicportallocator.h"
21 #include "webrtc/base/asyncpacketsocket.h"
22 23
23 namespace rtc { 24 namespace rtc {
24 class AsyncResolver; 25 class AsyncResolver;
25 class SignalThread; 26 class SignalThread;
26 } 27 }
27 28
28 namespace cricket { 29 namespace cricket {
29 30
30 extern const char TURN_PORT_TYPE[]; 31 extern const char TURN_PORT_TYPE[];
31 class TurnAllocateRequest; 32 class TurnAllocateRequest;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const std::string& nonce() const { return nonce_; } 116 const std::string& nonce() const { return nonce_; }
116 117
117 int error() const { return error_; } 118 int error() const { return error_; }
118 119
119 void OnAllocateMismatch(); 120 void OnAllocateMismatch();
120 121
121 rtc::AsyncPacketSocket* socket() const { 122 rtc::AsyncPacketSocket* socket() const {
122 return socket_; 123 return socket_;
123 } 124 }
124 125
126 // For testing only.
127 rtc::AsyncInvoker* invoker() { return &invoker_; }
128
125 // Signal with resolved server address. 129 // Signal with resolved server address.
126 // Parameters are port, server address and resolved server address. 130 // Parameters are port, server address and resolved server address.
127 // This signal will be sent only if server address is resolved successfully. 131 // This signal will be sent only if server address is resolved successfully.
128 sigslot::signal3<TurnPort*, 132 sigslot::signal3<TurnPort*,
129 const rtc::SocketAddress&, 133 const rtc::SocketAddress&,
130 const rtc::SocketAddress&> SignalResolvedServerAddress; 134 const rtc::SocketAddress&> SignalResolvedServerAddress;
131 135
132 // This signal is only for testing purpose. 136 // This signal is only for testing purpose.
133 sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int> 137 sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int>
134 SignalCreatePermissionResult; 138 SignalCreatePermissionResult;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 bool ScheduleRefresh(int lifetime); 212 bool ScheduleRefresh(int lifetime);
209 void SendRequest(StunRequest* request, int delay); 213 void SendRequest(StunRequest* request, int delay);
210 int Send(const void* data, size_t size, 214 int Send(const void* data, size_t size,
211 const rtc::PacketOptions& options); 215 const rtc::PacketOptions& options);
212 void UpdateHash(); 216 void UpdateHash();
213 bool UpdateNonce(StunMessage* response); 217 bool UpdateNonce(StunMessage* response);
214 218
215 bool HasPermission(const rtc::IPAddress& ipaddr) const; 219 bool HasPermission(const rtc::IPAddress& ipaddr) const;
216 TurnEntry* FindEntry(const rtc::SocketAddress& address) const; 220 TurnEntry* FindEntry(const rtc::SocketAddress& address) const;
217 TurnEntry* FindEntry(int channel_id) const; 221 TurnEntry* FindEntry(int channel_id) const;
218 TurnEntry* CreateEntry(const rtc::SocketAddress& address); 222 void CreateOrRefreshEntry(const rtc::SocketAddress& address);
219 void DestroyEntry(const rtc::SocketAddress& address); 223 void DestroyEntry(TurnEntry* entry);
224 // Destroys the entry only if |timestamp| matches the destruction timestamp
225 // in |entry|.
226 void DestroyEntryIfNotCancelled(TurnEntry* entry, uint32_t timestamp);
227 void ScheduleEntryDestruction(TurnEntry* entry);
228 void CancelEntryDestruction(TurnEntry* entry);
220 void OnConnectionDestroyed(Connection* conn); 229 void OnConnectionDestroyed(Connection* conn);
221 230
222 ProtocolAddress server_address_; 231 ProtocolAddress server_address_;
223 RelayCredentials credentials_; 232 RelayCredentials credentials_;
224 AttemptedServerSet attempted_server_addresses_; 233 AttemptedServerSet attempted_server_addresses_;
225 234
226 rtc::AsyncPacketSocket* socket_; 235 rtc::AsyncPacketSocket* socket_;
227 SocketOptionsMap socket_options_; 236 SocketOptionsMap socket_options_;
228 rtc::AsyncResolverInterface* resolver_; 237 rtc::AsyncResolverInterface* resolver_;
229 int error_; 238 int error_;
230 239
231 StunRequestManager request_manager_; 240 StunRequestManager request_manager_;
232 std::string realm_; // From 401/438 response message. 241 std::string realm_; // From 401/438 response message.
233 std::string nonce_; // From 401/438 response message. 242 std::string nonce_; // From 401/438 response message.
234 std::string hash_; // Digest of username:realm:password 243 std::string hash_; // Digest of username:realm:password
235 244
236 int next_channel_number_; 245 int next_channel_number_;
237 EntryList entries_; 246 EntryList entries_;
238 247
239 PortState state_; 248 PortState state_;
240 // By default the value will be set to 0. This value will be used in 249 // By default the value will be set to 0. This value will be used in
241 // calculating the candidate priority. 250 // calculating the candidate priority.
242 int server_priority_; 251 int server_priority_;
243 252
244 // The number of retries made due to allocate mismatch error. 253 // The number of retries made due to allocate mismatch error.
245 size_t allocate_mismatch_retries_; 254 size_t allocate_mismatch_retries_;
246 255
256 rtc::AsyncInvoker invoker_;
257
247 friend class TurnEntry; 258 friend class TurnEntry;
248 friend class TurnAllocateRequest; 259 friend class TurnAllocateRequest;
249 friend class TurnRefreshRequest; 260 friend class TurnRefreshRequest;
250 friend class TurnCreatePermissionRequest; 261 friend class TurnCreatePermissionRequest;
251 friend class TurnChannelBindRequest; 262 friend class TurnChannelBindRequest;
252 }; 263 };
253 264
254 } // namespace cricket 265 } // namespace cricket
255 266
256 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ 267 #endif // WEBRTC_P2P_BASE_TURNPORT_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/turnport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698