From 5e53f35b728658781f1f147d4d1f22abca9f55c5 Mon Sep 17 00:00:00 2001 From: gitpubber <76197622+gitpubber@users.noreply.github.com> Date: Fri, 7 May 2021 21:05:33 +0530 Subject: [PATCH] Change ClientImpl to ClientImplCloser We cannot close underlying Boltdb PieceCompletion if it is not closable --- storage/file.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)) }