Skip to content

Commit

Permalink
Check for ErrClosed on ice transport close
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonVerkada committed Feb 2, 2024
1 parent 372c0a2 commit ec352d5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions icetransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package webrtc

import (
"context"
"errors"
"fmt"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -197,9 +198,13 @@ func (t *ICETransport) Stop() error {
}

if t.mux != nil {
return t.mux.Close()
if err := t.mux.Close(); err != nil && !errors.Is(err, ice.ErrClosed) {
return err
}
} else if t.gatherer != nil {
return t.gatherer.Close()
if err := t.gatherer.Close(); err != nil && !errors.Is(err, ice.ErrClosed) {
return err
}
}
return nil
}
Expand Down

0 comments on commit ec352d5

Please sign in to comment.