This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,13 +37,21 @@ func (w *Watcher) purgeEvents() { | |
} | ||
|
||
if (fsnFlags&FSN_RENAME == FSN_RENAME) && ev.IsRename() { | ||
//w.RemoveWatch(ev.Name) | ||
sendEvent = true | ||
} | ||
|
||
if sendEvent { | ||
w.Event <- ev | ||
} | ||
|
||
// If there's no file, then no more events for user | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
howeyc
Author
Owner
|
||
// BSD must keep watch for internal use (watches DELETEs to keep track | ||
// what files exist for create events) | ||
if ev.IsDelete() { | ||
w.fsnmut.Lock() | ||
delete(w.fsnFlags, ev.Name) | ||
w.fsnmut.Unlock() | ||
} | ||
} | ||
|
||
close(w.Event) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@howeyc I'm trying to understand this block of code. So removing fsnFlags here would effectively prevent any additional events from occurring on that file because it is 0? But there are places where if fsnFlags is not found it takes on FSN_ALL?
The reason I'm trying to understand this is because
purgeEvents
is just one kind of filter on events coming off the channel. Ifos/fsnotify
isn't going to implement any sort of filters, I'd propose to exclude this code and process all events in user-code or a third-party library. But in doing that, what do we lose?