Skip to content

Commit

Permalink
Another minor cosmetic fix to unseasoned stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AZ-X committed Feb 15, 2022
1 parent fb86afe commit e6fd8bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions repique/behaviors/fswatcher_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ https://github.com/howeyc/fsnotify
https://github.com/fsnotify/fsnotify
*/// in the world by AZ-X. You are lucky to see these messages since https://github.com/golang/go/issues/44593 was public


type watcher struct {
folder string
files []fs
files *atomic.Value //[]fs
win_handle syscall.Handle
}

Expand Down Expand Up @@ -108,7 +107,7 @@ func setEvent(hEvent syscall.Handle) bool {
}

func satisfyCallback(idx int) {
for _, fs := range fswatcher[idx].files {
for _, fs := range fswatcher[idx].files.Load().([]fs) {
lastinfo := fs.lastinfo.Load().(os.FileInfo)
if info, err := os.Stat(fs.filepath); err != nil {
panic("satisfyCallback failed:" + err.Error())
Expand Down Expand Up @@ -169,7 +168,7 @@ func fswatcher_init () {
for _, w := range fswatcher {
if w.folder == dir {
found = true
w.files = append(w.files, fs0)
w.files.Store(append(w.files.Load().([]fs), fs0))
break
}
}
Expand All @@ -178,7 +177,8 @@ func fswatcher_init () {
if handle, err := findFirstChangeNotification(path_ptr, false, syscall.FILE_NOTIFY_CHANGE_LAST_WRITE); err != nil {
panic("fswatcher_init failed:" + err.Error())
} else {
w := watcher{folder:dir, files:[]fs{fs0}, win_handle:handle}
w := watcher{folder:dir, files:&atomic.Value{}, win_handle:handle}
w.files.Store([]fs{fs0})
fswatcher = append(fswatcher, w)
if !setEvent(reset) {
panic("fswatcher_init failed to call SetEvent")
Expand Down
2 changes: 1 addition & 1 deletion repique/features/dns/channels/channel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ type ChannelMgr struct {
}

func (mgr *ChannelMgr) Init(listeners int) {
s := &Starter{}
e := &End{}
mgr.ListenerCfg = &ListenerCfg{Cfgs:make([]*Config, listeners + 1)}
mgr.channels_list = make([]map[string]Channel, listeners + 1)
for idx := 0; idx <= listeners; idx++ {
mgr.channels_list[idx] = make(map[string]Channel)
s := &Starter{}
mgr.Register(idx, s)
mgr.Register(idx, e)
}
Expand Down

0 comments on commit e6fd8bd

Please sign in to comment.