Index: webrtc/p2p/base/stunport.cc |
diff --git a/webrtc/p2p/base/stunport.cc b/webrtc/p2p/base/stunport.cc |
index 8f37dd5218bb745b5e06ab6d8b2574faefc9aa44..a2f722b91b730ec6db17b90df5095ceae8731549 100644 |
--- a/webrtc/p2p/base/stunport.cc |
+++ b/webrtc/p2p/base/stunport.cc |
@@ -29,6 +29,9 @@ const int RETRY_TIMEOUT = 50 * 1000; // ICE says 50 secs |
// (in milliseconds) because the connection binding requests should keep |
// the NAT binding alive. |
const int KEEP_ALIVE_TIMEOUT = 2 * 60 * 1000; // 2 minutes |
+// This maximum deadline is used for low cost networks in order to keep the NAT |
+// binding alive on a backup connection. |
+const uint32_t MAX_KEEP_ALIVE_DEADLINE = 0xFFFFFFFF; |
// Handles a binding request sent to the STUN server. |
class StunBindingRequest : public StunRequest { |
@@ -397,8 +400,10 @@ void UDPPort::SendStunBindingRequest(const rtc::SocketAddress& stun_addr) { |
} else if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND) { |
// Check if |server_addr_| is compatible with the port's ip. |
if (IsCompatibleAddress(stun_addr)) { |
- requests_.Send(new StunBindingRequest(this, stun_addr, |
- rtc::Time() + KEEP_ALIVE_TIMEOUT)); |
+ uint32_t deadline = (network_cost() == 0) |
juberti2
2016/02/26 01:53:41
I don't like the |deadline| terminology - it's rea
honghaiz3
2016/02/26 18:46:57
Added comments.
Renamed it to keepalive_lifetime.
|
+ ? MAX_KEEP_ALIVE_DEADLINE |
+ : rtc::Time() + KEEP_ALIVE_TIMEOUT; |
+ requests_.Send(new StunBindingRequest(this, stun_addr, deadline)); |
} else { |
// Since we can't send stun messages to the server, we should mark this |
// port ready. |