Skip to content

Commit

Permalink
all: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Jun 14, 2024
1 parent e033558 commit c545152
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion internal/aghnet/hostscontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ func (hc *HostsContainer) handleEvents() {

defer close(hc.updates)

ok, eventsCh := true, hc.watcher.Events()
eventsCh := hc.watcher.Events()
ok := eventsCh != nil
for ok {
select {
case _, ok = <-eventsCh:
Expand Down
12 changes: 8 additions & 4 deletions internal/aghos/fswatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,26 @@ type EmptyFSWatcher struct{}
// type check
var _ FSWatcher = EmptyFSWatcher{}

// Start implements the [FSWatcher] interface for EmptyFSWatcher.
// Start implements the [FSWatcher] interface for EmptyFSWatcher. It always
// returns nil error.
func (EmptyFSWatcher) Start() (err error) {
return nil
}

// Close implements the [FSWatcher] interface for EmptyFSWatcher.
// Close implements the [FSWatcher] interface for EmptyFSWatcher. It always
// returns nil error.
func (EmptyFSWatcher) Close() (err error) {
return nil
}

// Events implements the [FSWatcher] interface for EmptyFSWatcher.
// Events implements the [FSWatcher] interface for EmptyFSWatcher. It always
// returns nil channel.
func (EmptyFSWatcher) Events() (e <-chan event) {
return nil
}

// Add implements the [FSWatcher] interface for EmptyFSWatcher.
// Add implements the [FSWatcher] interface for EmptyFSWatcher. It always
// returns nil error.
func (EmptyFSWatcher) Add(_ string) (err error) {
return nil
}

0 comments on commit c545152

Please sign in to comment.