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

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

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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Parameters are port, server address and resolved server address. 134 // Parameters are port, server address and resolved server address.
135 // This signal will be sent only if server address is resolved successfully. 135 // This signal will be sent only if server address is resolved successfully.
136 sigslot::signal3<TurnPort*, 136 sigslot::signal3<TurnPort*,
137 const rtc::SocketAddress&, 137 const rtc::SocketAddress&,
138 const rtc::SocketAddress&> SignalResolvedServerAddress; 138 const rtc::SocketAddress&> SignalResolvedServerAddress;
139 139
140 // All public methods/signals below are for testing only. 140 // All public methods/signals below are for testing only.
141 sigslot::signal2<TurnPort*, int> SignalTurnRefreshResult; 141 sigslot::signal2<TurnPort*, int> SignalTurnRefreshResult;
142 sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int> 142 sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int>
143 SignalCreatePermissionResult; 143 SignalCreatePermissionResult;
144 void FlushRequests() { request_manager_.Flush(); } 144 void FlushRequests(int msg_type) { request_manager_.Flush(msg_type); }
145 bool RequestsEmpty() { return request_manager_.empty(); }
pthatcher1 2016/01/05 00:10:03 How about name this HasRequests() (with the opposi
honghaiz3 2016/01/05 04:47:39 Done.
145 void set_credentials(RelayCredentials& credentials) { 146 void set_credentials(RelayCredentials& credentials) {
146 credentials_ = credentials; 147 credentials_ = credentials;
147 } 148 }
148 // Finds the turn entry with |address| and sets its channel id. 149 // Finds the turn entry with |address| and sets its channel id.
149 // Returns true if the entry is found. 150 // Returns true if the entry is found.
150 bool SetEntryChannelId(const rtc::SocketAddress& address, int channel_id); 151 bool SetEntryChannelId(const rtc::SocketAddress& address, int channel_id);
151 152
152 protected: 153 protected:
153 TurnPort(rtc::Thread* thread, 154 TurnPort(rtc::Thread* thread,
154 rtc::PacketSocketFactory* factory, 155 rtc::PacketSocketFactory* factory,
(...skipping 16 matching lines...) Expand all
171 const std::string& password, 172 const std::string& password,
172 const ProtocolAddress& server_address, 173 const ProtocolAddress& server_address,
173 const RelayCredentials& credentials, 174 const RelayCredentials& credentials,
174 int server_priority, 175 int server_priority,
175 const std::string& origin); 176 const std::string& origin);
176 177
177 private: 178 private:
178 enum { 179 enum {
179 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, 180 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE,
180 MSG_ALLOCATE_MISMATCH, 181 MSG_ALLOCATE_MISMATCH,
181 MSG_TRY_ALTERNATE_SERVER 182 MSG_TRY_ALTERNATE_SERVER,
183 MSG_REFRESH_ERROR
182 }; 184 };
183 185
184 typedef std::list<TurnEntry*> EntryList; 186 typedef std::list<TurnEntry*> EntryList;
185 typedef std::map<rtc::Socket::Option, int> SocketOptionsMap; 187 typedef std::map<rtc::Socket::Option, int> SocketOptionsMap;
186 typedef std::set<rtc::SocketAddress> AttemptedServerSet; 188 typedef std::set<rtc::SocketAddress> AttemptedServerSet;
187 189
188 virtual void OnMessage(rtc::Message* pmsg); 190 virtual void OnMessage(rtc::Message* pmsg);
189 191
190 bool CreateTurnClientSocket(); 192 bool CreateTurnClientSocket();
191 193
192 void set_nonce(const std::string& nonce) { nonce_ = nonce; } 194 void set_nonce(const std::string& nonce) { nonce_ = nonce; }
193 void set_realm(const std::string& realm) { 195 void set_realm(const std::string& realm) {
194 if (realm != realm_) { 196 if (realm != realm_) {
195 realm_ = realm; 197 realm_ = realm;
196 UpdateHash(); 198 UpdateHash();
197 } 199 }
198 } 200 }
199 201
200 // Shuts down the turn port, usually because of some fatal errors. 202 // Shuts down the turn port, usually because of some fatal errors.
201 void Close(); 203 void Close();
202 void OnTurnRefreshError() { Close(); } 204 void OnTurnRefreshError();
203 bool SetAlternateServer(const rtc::SocketAddress& address); 205 bool SetAlternateServer(const rtc::SocketAddress& address);
204 void ResolveTurnAddress(const rtc::SocketAddress& address); 206 void ResolveTurnAddress(const rtc::SocketAddress& address);
205 void OnResolveResult(rtc::AsyncResolverInterface* resolver); 207 void OnResolveResult(rtc::AsyncResolverInterface* resolver);
206 208
207 void AddRequestAuthInfo(StunMessage* msg); 209 void AddRequestAuthInfo(StunMessage* msg);
208 void OnSendStunPacket(const void* data, size_t size, StunRequest* request); 210 void OnSendStunPacket(const void* data, size_t size, StunRequest* request);
209 // Stun address from allocate success response. 211 // Stun address from allocate success response.
210 // Currently used only for testing. 212 // Currently used only for testing.
211 void OnStunAddress(const rtc::SocketAddress& address); 213 void OnStunAddress(const rtc::SocketAddress& address);
212 void OnAllocateSuccess(const rtc::SocketAddress& address, 214 void OnAllocateSuccess(const rtc::SocketAddress& address,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 friend class TurnEntry; 278 friend class TurnEntry;
277 friend class TurnAllocateRequest; 279 friend class TurnAllocateRequest;
278 friend class TurnRefreshRequest; 280 friend class TurnRefreshRequest;
279 friend class TurnCreatePermissionRequest; 281 friend class TurnCreatePermissionRequest;
280 friend class TurnChannelBindRequest; 282 friend class TurnChannelBindRequest;
281 }; 283 };
282 284
283 } // namespace cricket 285 } // namespace cricket
284 286
285 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ 287 #endif // WEBRTC_P2P_BASE_TURNPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698