Update checkKeepalive to also check LastReceived

Ping Candidate if remote.LastReceived is over
than keepaliveInterval
This commit is contained in:
JooYoung
2020-08-27 19:14:09 -07:00
committed by Sean DuBois
parent baf53ee92b
commit 435c65f61d
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -56,6 +56,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
* [Henry](https://github.com/cryptix)
* [Jerko Steiner](https://github.com/jeremija)
* [Sidney San Martín](https://github.com/s4y)
* [JooYoung Lim](https://github.com/DevRockstarZ)
### License
MIT License - see [LICENSE](LICENSE) for full text
+2 -1
View File
@@ -692,7 +692,8 @@ func (a *Agent) checkKeepalive() {
}
if (a.keepaliveInterval != 0) &&
(time.Since(selectedPair.local.LastSent()) > a.keepaliveInterval) {
((time.Since(selectedPair.local.LastSent()) > a.keepaliveInterval) ||
(time.Since(selectedPair.remote.LastReceived()) > a.keepaliveInterval)) {
// we use binding request instead of indication to support refresh consent schemas
// see https://tools.ietf.org/html/rfc7675
a.selector.PingCandidate(selectedPair.local, selectedPair.remote)