Repository: pion/ice (go)

Issue:
ICE connection fails when RTT > 500 msec

### Your environment.
  - Version: pion/ice v0.7.17 (pion/webrtc v2.2.21)
  - Browser: n/a

### What did you do?
Try to establish connection (the test app uses a data channel) between two nodes with large latency (using comcast)

### What did you expect?
The connection would establish successfully with RTT 500 msec or greater.

### What happened?
ICE connection fails with this line in the console output:
```
ice TRACE: 00:47:20.775035 agent.go:1039: Discarded 1 binding requests because they expired
```

Looking at the code (agent.go), the current implementation discards the binding request transaction in 500 msec.
500 msec is too short for STUN transaction to expire. In RFC 5439, when initial RTO=500msec, Rc=7, Rm=16, then the transaction is expected to fail in 39500msec (or 39.5 seconds). 


Pull request:
Increase binding req timeout value
Resolves #255

#### Description
See #255 for details

Per discussion with @Sean-Der we decided to simply increase the maxBindingRequestTImeout from 500msec to 4000msec.

Patch:
diff --git a/agent_config.go b/agent_config.go
index 25c38f0..c7198af 100644
--- a/agent_config.go
+++ b/agent_config.go
@@ -39,7 +39,7 @@ const (
 	maxBufferSize = 1000 * 1000 // 1MB
 
 	// wait time before binding requests can be deleted
-	maxBindingRequestTimeout = 500 * time.Millisecond
+	maxBindingRequestTimeout = 4000 * time.Millisecond
 )
 
 var (


Test patch:
diff --git a/agent_test.go b/agent_test.go
index 0f9bba0..966c71e 100644
--- a/agent_test.go
+++ b/agent_test.go
@@ -1208,20 +1208,20 @@ func TestBindingRequestTimeout(t *testing.T) {
 
 	now := time.Now()
 	a.pendingBindingRequests = append(a.pendingBindingRequests, bindingRequest{
-		timestamp: now,
+		timestamp: now, // valid
 	})
 	a.pendingBindingRequests = append(a.pendingBindingRequests, bindingRequest{
-		timestamp: now.Add(-25 * time.Millisecond),
+		timestamp: now.Add(-3900 * time.Millisecond), // valid
 	})
 	a.pendingBindingRequests = append(a.pendingBindingRequests, bindingRequest{
-		timestamp: now.Add(-750 * time.Millisecond),
+		timestamp: now.Add(-4100 * time.Millisecond), // invalid
 	})
 	a.pendingBindingRequests = append(a.pendingBindingRequests, bindingRequest{
-		timestamp: now.Add(-75 * time.Hour),
+		timestamp: now.Add(-75 * time.Hour), // invalid
 	})
 
 	a.invalidatePendingBindingRequests(now)
-	assert.Equal(t, len(a.pendingBindingRequests), expectedRemovalCount, "Binding invalidation due to timeout did not remove the correct number of binding requests")
+	assert.Equal(t, expectedRemovalCount, len(a.pendingBindingRequests), "Binding invalidation due to timeout did not remove the correct number of binding requests")
 	assert.NoError(t, a.Close())
 }