From 35bb3fb992f8f70c4613364583e4d84864e98565 Mon Sep 17 00:00:00 2001 From: Amin Cheloh Date: Mon, 2 Sep 2024 22:06:38 +0700 Subject: [PATCH 1/3] docs(agent_config.go): update KeepaliveInterval default value to 2 sec Update documentation for KeepaliveInterval to match defaultKeepaliveInterval constant --- agent_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent_config.go b/agent_config.go index 8d3f2816..7c7ecf6f 100644 --- a/agent_config.go +++ b/agent_config.go @@ -91,7 +91,7 @@ type AgentConfig struct { // KeepaliveInterval determines how often should we send ICE // keepalives (should be less then connectiontimeout above) - // when this is nil, it defaults to 10 seconds. + // when this is nil, it defaults to 2 seconds. // A keepalive interval of 0 means we never send keepalive packets KeepaliveInterval *time.Duration From c9abe8bfe02352889c03ed1e74adf9e1a6fdbc86 Mon Sep 17 00:00:00 2001 From: Daniel Kessler Date: Thu, 9 Jan 2025 15:48:42 -0800 Subject: [PATCH 2/3] Add nil checks to agent_handlers (#751) Co-authored-by: Daniel Kessler --- agent_handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent_handlers.go b/agent_handlers.go index 0c02277b..c245f0c2 100644 --- a/agent_handlers.go +++ b/agent_handlers.go @@ -26,19 +26,19 @@ func (a *Agent) OnCandidate(f func(Candidate)) error { } func (a *Agent) onSelectedCandidatePairChange(p *CandidatePair) { - if h, ok := a.onSelectedCandidatePairChangeHdlr.Load().(func(Candidate, Candidate)); ok { + if h, ok := a.onSelectedCandidatePairChangeHdlr.Load().(func(Candidate, Candidate)); ok && h != nil { h(p.Local, p.Remote) } } func (a *Agent) onCandidate(c Candidate) { - if onCandidateHdlr, ok := a.onCandidateHdlr.Load().(func(Candidate)); ok { + if onCandidateHdlr, ok := a.onCandidateHdlr.Load().(func(Candidate)); ok && onCandidateHdlr != nil { onCandidateHdlr(c) } } func (a *Agent) onConnectionStateChange(s ConnectionState) { - if hdlr, ok := a.onConnectionStateChangeHdlr.Load().(func(ConnectionState)); ok { + if hdlr, ok := a.onConnectionStateChangeHdlr.Load().(func(ConnectionState)); ok && hdlr != nil { hdlr(s) } } From abdc0cadecf914182e772b27ff74223891073d53 Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Mon, 13 Jan 2025 04:48:00 -0800 Subject: [PATCH 3/3] Use addrEqual for candidate comparison (#752) --- candidate_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/candidate_base.go b/candidate_base.go index ab4d3738..ac9d8570 100644 --- a/candidate_base.go +++ b/candidate_base.go @@ -402,7 +402,7 @@ func (c *candidateBase) Equal(other Candidate) bool { if c.addr() == nil || other.addr() == nil { return false } - if c.addr().String() != other.addr().String() { + if !addrEqual(c.addr(), other.addr()) { return false } }