Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions examples/ping-pong/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ func remoteCandidate(_ http.ResponseWriter, r *http.Request) {
panic(err)
}

if err := iceAgent.AddRemoteCandidate(c); err != nil { //nolint:contextcheck
panic(err)
if c != nil {
if err := iceAgent.AddRemoteCandidate(c); err != nil { //nolint:contextcheck
panic(err)
}
}
}

Expand All @@ -70,6 +72,11 @@ func main() { //nolint
remoteHTTPPort = 9000
}

iceAgent, err = ice.NewAgent()
if err != nil {
panic(err)
}

http.HandleFunc("/remoteAuth", remoteAuth)
http.HandleFunc("/remoteCandidate", remoteCandidate)
go func() {
Expand All @@ -88,11 +95,6 @@ func main() { //nolint
panic(err)
}

iceAgent, err = ice.NewAgent()
if err != nil {
panic(err)
}

// When we have gathered a new ICE Candidate send it to the remote peer
if err = iceAgent.OnCandidate(func(c ice.Candidate) {
if c == nil {
Expand Down
Loading