Index: webrtc/p2p/base/turnserver.h |
diff --git a/webrtc/p2p/base/turnserver.h b/webrtc/p2p/base/turnserver.h |
index 113bd4c4623d06c118a1b05ede79bceee2d72ad6..df5b2ff2acfac92efbbd0130dc83b87a0f20a7ae 100644 |
--- a/webrtc/p2p/base/turnserver.h |
+++ b/webrtc/p2p/base/turnserver.h |
@@ -199,6 +199,12 @@ class TurnServer : public sigslot::has_slots<> { |
// Specifies the factory to use for creating external sockets. |
void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, |
const rtc::SocketAddress& address); |
+ // Visible for testing. |
+ std::string GenerateNonce(uint32_t now) const; |
+ // For testing only. |
+ void SetTimestampForNextNonce(uint32_t timestamp) { |
+ ts_for_next_nonce_ = timestamp; |
+ } |
Taylor Brandstetter
2016/01/26 02:02:06
Instead of this, would it be reasonable to add a "
honghaiz3
2016/01/27 01:45:23
Looking through all allocations to find the duplic
Taylor Brandstetter
2016/01/27 02:02:42
Now that we discussed this and I understand the pr
|
private: |
void OnInternalPacket(rtc::AsyncPacketSocket* socket, const char* data, |
@@ -221,7 +227,6 @@ class TurnServer : public sigslot::has_slots<> { |
bool CheckAuthorization(TurnServerConnection* conn, const StunMessage* msg, |
const char* data, size_t size, |
const std::string& key); |
- std::string GenerateNonce() const; |
bool ValidateNonce(const std::string& nonce) const; |
TurnServerAllocation* FindAllocation(TurnServerConnection* conn); |
@@ -270,6 +275,10 @@ class TurnServer : public sigslot::has_slots<> { |
AllocationMap allocations_; |
+ // For testing only. If this is non-zero, the next NONCE will be generated |
+ // from this value, and it will be reset to 0 after generating the NONCE. |
+ uint32_t ts_for_next_nonce_ = 0; |
+ |
friend class TurnServerAllocation; |
}; |