1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +08:00

fsrepo.LockedByOtherProcess no longer checks for local opens

This is only called from `ipfs` command line tool well before it opens
the repo. The behavior change here causes a false positive if the
current process has already opened the repo. That's a bit late to ask
this question, anyway, and is not expected to have ever triggered.
This commit is contained in:
Tommi Virtanen
2015-03-13 14:38:33 -07:00
parent e0bee137e9
commit 215fed1051

View File

@ -172,12 +172,11 @@ func Remove(repoPath string) error {
func LockedByOtherProcess(repoPath string) bool {
repoPath = path.Clean(repoPath)
// packageLock must be held to check the number of openers.
packageLock.Lock()
defer packageLock.Unlock()
// TODO replace this with the "api" file
// https://github.com/ipfs/specs/tree/master/repo/fs-repo
// NB: the lock is only held when repos are Open
return lockfile.Locked(repoPath) && openersCounter.NumOpeners(repoPath) == 0
return lockfile.Locked(repoPath)
}
// openConfig returns an error if the config file is not present.