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

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

Issue 2090833002: Revert of Do not delete a connection in the turn port with permission error or refresh error. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 6 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/port.cc ('k') | 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
(...skipping 20 matching lines...) Expand all
31 extern const char TURN_PORT_TYPE[]; 31 extern const char TURN_PORT_TYPE[];
32 class TurnAllocateRequest; 32 class TurnAllocateRequest;
33 class TurnEntry; 33 class TurnEntry;
34 34
35 class TurnPort : public Port { 35 class TurnPort : public Port {
36 public: 36 public:
37 enum PortState { 37 enum PortState {
38 STATE_CONNECTING, // Initial state, cannot send any packets. 38 STATE_CONNECTING, // Initial state, cannot send any packets.
39 STATE_CONNECTED, // Socket connected, ready to send stun requests. 39 STATE_CONNECTED, // Socket connected, ready to send stun requests.
40 STATE_READY, // Received allocate success, can send any packets. 40 STATE_READY, // Received allocate success, can send any packets.
41 STATE_RECEIVEONLY, // Had REFRESH_REQUEST error, cannot send any packets. 41 STATE_DISCONNECTED, // TCP connection died, cannot send any packets.
42 STATE_DISCONNECTED, // TCP connection died, cannot send/receive any
43 // packets.
44 }; 42 };
45 static TurnPort* Create(rtc::Thread* thread, 43 static TurnPort* Create(rtc::Thread* thread,
46 rtc::PacketSocketFactory* factory, 44 rtc::PacketSocketFactory* factory,
47 rtc::Network* network, 45 rtc::Network* network,
48 rtc::AsyncPacketSocket* socket, 46 rtc::AsyncPacketSocket* socket,
49 const std::string& username, // ice username. 47 const std::string& username, // ice username.
50 const std::string& password, // ice password. 48 const std::string& password, // ice password.
51 const ProtocolAddress& server_address, 49 const ProtocolAddress& server_address,
52 const RelayCredentials& credentials, 50 const RelayCredentials& credentials,
53 int server_priority, 51 int server_priority,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 bool CreateTurnClientSocket(); 195 bool CreateTurnClientSocket();
198 196
199 void set_nonce(const std::string& nonce) { nonce_ = nonce; } 197 void set_nonce(const std::string& nonce) { nonce_ = nonce; }
200 void set_realm(const std::string& realm) { 198 void set_realm(const std::string& realm) {
201 if (realm != realm_) { 199 if (realm != realm_) {
202 realm_ = realm; 200 realm_ = realm;
203 UpdateHash(); 201 UpdateHash();
204 } 202 }
205 } 203 }
206 204
207 void OnRefreshError(); 205 void OnTurnRefreshError();
208 void HandleRefreshError();
209 bool SetAlternateServer(const rtc::SocketAddress& address); 206 bool SetAlternateServer(const rtc::SocketAddress& address);
210 void ResolveTurnAddress(const rtc::SocketAddress& address); 207 void ResolveTurnAddress(const rtc::SocketAddress& address);
211 void OnResolveResult(rtc::AsyncResolverInterface* resolver); 208 void OnResolveResult(rtc::AsyncResolverInterface* resolver);
212 209
213 void AddRequestAuthInfo(StunMessage* msg); 210 void AddRequestAuthInfo(StunMessage* msg);
214 void OnSendStunPacket(const void* data, size_t size, StunRequest* request); 211 void OnSendStunPacket(const void* data, size_t size, StunRequest* request);
215 // Stun address from allocate success response. 212 // Stun address from allocate success response.
216 // Currently used only for testing. 213 // Currently used only for testing.
217 void OnStunAddress(const rtc::SocketAddress& address); 214 void OnStunAddress(const rtc::SocketAddress& address);
218 void OnAllocateSuccess(const rtc::SocketAddress& address, 215 void OnAllocateSuccess(const rtc::SocketAddress& address,
(...skipping 22 matching lines...) Expand all
241 TurnEntry* FindEntry(int channel_id) const; 238 TurnEntry* FindEntry(int channel_id) const;
242 bool EntryExists(TurnEntry* e); 239 bool EntryExists(TurnEntry* e);
243 void CreateOrRefreshEntry(const rtc::SocketAddress& address); 240 void CreateOrRefreshEntry(const rtc::SocketAddress& address);
244 void DestroyEntry(TurnEntry* entry); 241 void DestroyEntry(TurnEntry* entry);
245 // Destroys the entry only if |timestamp| matches the destruction timestamp 242 // Destroys the entry only if |timestamp| matches the destruction timestamp
246 // in |entry|. 243 // in |entry|.
247 void DestroyEntryIfNotCancelled(TurnEntry* entry, int64_t timestamp); 244 void DestroyEntryIfNotCancelled(TurnEntry* entry, int64_t timestamp);
248 void ScheduleEntryDestruction(TurnEntry* entry); 245 void ScheduleEntryDestruction(TurnEntry* entry);
249 void CancelEntryDestruction(TurnEntry* entry); 246 void CancelEntryDestruction(TurnEntry* entry);
250 247
251 // Marks the connection with remote address |address| failed and 248 // Destroys the connection with remote address |address|. Returns true if
252 // pruned (a.k.a. write-timed-out). Returns true if a connection is found. 249 // a connection is found and destroyed.
253 bool FailAndPruneConnection(const rtc::SocketAddress& address); 250 bool DestroyConnection(const rtc::SocketAddress& address);
254 251
255 ProtocolAddress server_address_; 252 ProtocolAddress server_address_;
256 RelayCredentials credentials_; 253 RelayCredentials credentials_;
257 AttemptedServerSet attempted_server_addresses_; 254 AttemptedServerSet attempted_server_addresses_;
258 255
259 rtc::AsyncPacketSocket* socket_; 256 rtc::AsyncPacketSocket* socket_;
260 SocketOptionsMap socket_options_; 257 SocketOptionsMap socket_options_;
261 rtc::AsyncResolverInterface* resolver_; 258 rtc::AsyncResolverInterface* resolver_;
262 int error_; 259 int error_;
263 260
(...skipping 18 matching lines...) Expand all
282 friend class TurnEntry; 279 friend class TurnEntry;
283 friend class TurnAllocateRequest; 280 friend class TurnAllocateRequest;
284 friend class TurnRefreshRequest; 281 friend class TurnRefreshRequest;
285 friend class TurnCreatePermissionRequest; 282 friend class TurnCreatePermissionRequest;
286 friend class TurnChannelBindRequest; 283 friend class TurnChannelBindRequest;
287 }; 284 };
288 285
289 } // namespace cricket 286 } // namespace cricket
290 287
291 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ 288 #endif // WEBRTC_P2P_BASE_TURNPORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | webrtc/p2p/base/turnport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698