Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/tlz"
"github.com/openziti/identity/certtools"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"os"
"path/filepath"
"sort"
"strings"
"sync"
"sync/atomic"
"time"

"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/tlz"
"github.com/openziti/identity/certtools"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

const (
Expand Down
12 changes: 8 additions & 4 deletions identity_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ func (id *ID) startWatching() error {
}

go func() {
defer func() {
if closeErr := watcher.Close(); closeErr != nil {
logrus.WithError(closeErr).Error("error closing identity file watcher")
}
}()

for {
select {
case event, ok := <-watcher.Events:
Expand Down Expand Up @@ -82,11 +88,9 @@ func (id *ID) startWatching() error {
}()

for _, file := range files {
err := watcher.Add(file)

if err != nil {
if err = watcher.Add(file); err != nil {
_ = watcher.Close()
close(id.closeNotify)
return err
}
}

Expand Down
Loading