Index: webrtc/p2p/base/turnport.h |
diff --git a/webrtc/p2p/base/turnport.h b/webrtc/p2p/base/turnport.h |
index 3a1b4320e43b99f887d8351690114c900381254d..db2a3ceeeec8ff7e127d12758c15a1c12b41cb8a 100644 |
--- a/webrtc/p2p/base/turnport.h |
+++ b/webrtc/p2p/base/turnport.h |
@@ -16,9 +16,10 @@ |
#include <set> |
#include <string> |
+#include "webrtc/base/asyncinvoker.h" |
+#include "webrtc/base/asyncpacketsocket.h" |
#include "webrtc/p2p/base/port.h" |
#include "webrtc/p2p/client/basicportallocator.h" |
-#include "webrtc/base/asyncpacketsocket.h" |
namespace rtc { |
class AsyncResolver; |
@@ -122,6 +123,9 @@ class TurnPort : public Port { |
return socket_; |
} |
+ // For testing only. |
+ rtc::AsyncInvoker* invoker() { return &invoker_; } |
+ |
// Signal with resolved server address. |
// Parameters are port, server address and resolved server address. |
// This signal will be sent only if server address is resolved successfully. |
@@ -215,8 +219,13 @@ class TurnPort : public Port { |
bool HasPermission(const rtc::IPAddress& ipaddr) const; |
TurnEntry* FindEntry(const rtc::SocketAddress& address) const; |
TurnEntry* FindEntry(int channel_id) const; |
- TurnEntry* CreateEntry(const rtc::SocketAddress& address); |
- void DestroyEntry(const rtc::SocketAddress& address); |
+ void CreateOrRefreshEntry(const rtc::SocketAddress& address); |
+ void DestroyEntry(TurnEntry* entry); |
+ // Destroys the entry only if |timestamp| matches the destruction timestamp |
+ // in |entry|. |
+ void DestroyEntryIfNotCancelled(TurnEntry* entry, uint32_t timestamp); |
+ void ScheduleEntryDestruction(TurnEntry* entry); |
+ void CancelEntryDestruction(TurnEntry* entry); |
void OnConnectionDestroyed(Connection* conn); |
ProtocolAddress server_address_; |
@@ -244,6 +253,8 @@ class TurnPort : public Port { |
// The number of retries made due to allocate mismatch error. |
size_t allocate_mismatch_retries_; |
+ rtc::AsyncInvoker invoker_; |
+ |
friend class TurnEntry; |
friend class TurnAllocateRequest; |
friend class TurnRefreshRequest; |