From 302290a7846159720a0feaa9d0d696f62ee7b50f Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Mon, 16 Nov 2020 10:30:25 -0800 Subject: [PATCH] Use candidate context in validateNonSTUNTraffic This operation needs to be cancelled when the candidate is closed. Before it was only cancelled when the Agent was closed. Resolves #299 --- agent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent.go b/agent.go index 3d49b93..82de746 100644 --- a/agent.go +++ b/agent.go @@ -1105,7 +1105,7 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr) // and returns true if it is an actual remote candidate func (a *Agent) validateNonSTUNTraffic(local Candidate, remote net.Addr) bool { var isValidCandidate uint64 - if err := a.run(a.context(), func(ctx context.Context, agent *Agent) { + if err := a.run(local.context(), func(ctx context.Context, agent *Agent) { remoteCandidate := a.findRemoteCandidate(local.NetworkType(), remote) if remoteCandidate != nil { remoteCandidate.seen(false)