From: gitpubber <76197622+gitpubber@users.noreply.github.com> Date: Fri, 7 May 2021 15:35:33 +0000 (+0530) Subject: Change ClientImpl to ClientImplCloser X-Git-Tag: v1.27.0~1 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5e53f35b728658781f1f147d4d1f22abca9f55c5;p=btrtrc.git Change ClientImpl to ClientImplCloser We cannot close underlying Boltdb PieceCompletion if it is not closable --- diff --git a/storage/file.go b/storage/file.go index 66b0debf..a4c29015 100644 --- a/storage/file.go +++ b/storage/file.go @@ -40,14 +40,14 @@ func NewFileWithCompletion(baseDir string, completion PieceCompletion) *fileClie } // File storage with data partitioned by infohash. -func NewFileByInfoHash(baseDir string) ClientImpl { +func NewFileByInfoHash(baseDir string) ClientImplCloser { return NewFileWithCustomPathMaker(baseDir, infoHashPathMaker) } // Allows passing a function to determine the path for storing torrent data. The function is // responsible for sanitizing the info if it uses some part of it (for example sanitizing // info.Name). -func NewFileWithCustomPathMaker(baseDir string, pathMaker func(baseDir string, info *metainfo.Info, infoHash metainfo.Hash) string) ClientImpl { +func NewFileWithCustomPathMaker(baseDir string, pathMaker func(baseDir string, info *metainfo.Info, infoHash metainfo.Hash) string) ClientImplCloser { return newFileWithCustomPathMakerAndCompletion(baseDir, pathMaker, pieceCompletionForDir(baseDir)) }