diff --git a/agent.go b/agent.go index f8ee66e..5516484 100644 --- a/agent.go +++ b/agent.go @@ -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 diff --git a/internal/taskloop/taskloop.go b/internal/taskloop/taskloop.go index b850ab4..6e70efd 100644 --- a/internal/taskloop/taskloop.go +++ b/internal/taskloop/taskloop.go @@ -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.