From 435c65f61d7fd35cdbb3e1c0e68f52e92eb11ff7 Mon Sep 17 00:00:00 2001 From: JooYoung Date: Mon, 24 Aug 2020 15:07:57 +0900 Subject: [PATCH] Update checkKeepalive to also check LastReceived Ping Candidate if remote.LastReceived is over than keepaliveInterval --- README.md | 1 + agent.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ef6f52..0daf743 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/agent.go b/agent.go index 1bbe966..a81db93 100644 --- a/agent.go +++ b/agent.go @@ -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)