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
This commit is contained in:
Sean DuBois
2020-11-16 11:59:06 -08:00
parent 6da87f0fcf
commit 302290a784
+1 -1
View File
@@ -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)