Skip to content

Commit

Permalink
Use candidate context in validateNonSTUNTraffic
Browse files Browse the repository at this point in the history
This operation needs to be cancelled when the candidate is closed.
Before it was only cancelled when the Agent was closed.

Resolves #299
  • Loading branch information
Sean-Der committed Nov 16, 2020
1 parent 6da87f0 commit 302290a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 302290a

Please sign in to comment.