mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Allow multiple agent.Close
This commit is contained in:
committed by
Sean DuBois
parent
63ede543de
commit
28cf1cd9f3
@@ -861,14 +861,14 @@ func (a *Agent) GracefulClose() error {
|
||||
|
||||
func (a *Agent) close(graceful bool) error {
|
||||
// the loop is safe to wait on no matter what
|
||||
err := a.loop.Close()
|
||||
a.loop.Close()
|
||||
|
||||
// but we are in less control of the notifiers, so we will
|
||||
// pass through `graceful`.
|
||||
a.connectionStateNotifier.Close(graceful)
|
||||
a.candidateNotifier.Close(graceful)
|
||||
a.selectedCandidatePairNotifier.Close(graceful)
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remove all candidates. This closes any listening sockets
|
||||
|
||||
@@ -63,17 +63,15 @@ func (l *Loop) runLoop(onClose func()) {
|
||||
|
||||
// Close stops the loop after finishing the execution of the current task.
|
||||
// Other pending tasks will not be executed.
|
||||
func (l *Loop) Close() error {
|
||||
func (l *Loop) Close() {
|
||||
if err := l.Err(); err != nil {
|
||||
return err
|
||||
return
|
||||
}
|
||||
|
||||
l.err.Store(ErrClosed)
|
||||
|
||||
close(l.done)
|
||||
<-l.taskLoopDone
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Run serially executes the submitted callback.
|
||||
|
||||
Reference in New Issue
Block a user