mirror of https://github.com/zlatinb/muwire
canonicalize before checking if directory is watched. Add logging to debug GitHub issue #65
parent
2c3a0e5310
commit
6c55812721
|
@ -87,7 +87,7 @@ class HasherService {
|
|||
|
||||
void onDirectoryUnsharedEvent(DirectoryUnsharedEvent evt) {
|
||||
for(File dir : evt.directories)
|
||||
hashed.removeAll(dir)
|
||||
hashed.remove(dir)
|
||||
}
|
||||
|
||||
private synchronized void throttle(File f) {
|
||||
|
|
|
@ -63,11 +63,15 @@ class PersisterFolderService extends BasePersisterService {
|
|||
}
|
||||
|
||||
void onFileHashedEvent(FileHashedEvent hashedEvent) {
|
||||
if (hashedEvent.sharedFile == null)
|
||||
return
|
||||
if (core.getMuOptions().getAutoPublishSharedFiles() && hashedEvent.sharedFile != null)
|
||||
hashedEvent.sharedFile.publish(System.currentTimeMillis())
|
||||
|
||||
File file = hashedEvent.sharedFile.file
|
||||
hashedEvent.sharedFile.setPathToSharedParent(findSharedParent(file))
|
||||
Path root = findSharedParent(file)
|
||||
log.fine("PFS: for $file found root $root")
|
||||
hashedEvent.sharedFile.setPathToSharedParent(root)
|
||||
|
||||
persistFile(hashedEvent.sharedFile, hashedEvent.infoHash)
|
||||
}
|
||||
|
|
|
@ -131,17 +131,20 @@ class WatchedDirectoryManager {
|
|||
}
|
||||
|
||||
void onFileSharedEvent(FileSharedEvent e) {
|
||||
if (e.file.isFile() || watchedDirs.containsKey(e.file))
|
||||
File canonical = e.file.getCanonicalFile()
|
||||
if (canonical.isFile() || watchedDirs.containsKey(canonical))
|
||||
return
|
||||
if (!settings.shareHiddenFiles && e.file.isHidden())
|
||||
if (!settings.shareHiddenFiles && canonical.isHidden())
|
||||
return
|
||||
|
||||
def wd = new WatchedDirectory(e.file)
|
||||
log.fine("WDM: watching directory $canonical")
|
||||
|
||||
def wd = new WatchedDirectory(canonical)
|
||||
if (e.fromWatch) {
|
||||
// parent should be already watched, copy settings
|
||||
def parent = watchedDirs.get(e.file.getParentFile())
|
||||
def parent = watchedDirs.get(canonical.getParentFile())
|
||||
if (parent == null) {
|
||||
log.severe("watching found a directory without a watched parent? ${e.file}")
|
||||
log.severe("watching found a directory without a watched parent? ${canonical}")
|
||||
return
|
||||
}
|
||||
wd.autoWatch = parent.autoWatch
|
||||
|
|
Loading…
Reference in New Issue