mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-26 09:44:46 -07:00
refactor code for context fallthrough
This commit is contained in:
@@ -5,6 +5,7 @@ package torrentapproval
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/middleware"
|
||||
@@ -17,7 +18,6 @@ import (
|
||||
|
||||
// import static list to enable appropriate support
|
||||
_ "github.com/sot-tech/mochi/middleware/torrentapproval/container/list"
|
||||
"github.com/sot-tech/mochi/pkg/stop"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
)
|
||||
|
||||
@@ -86,9 +86,9 @@ func (h *hook) HandleScrape(ctx context.Context, _ *bittorrent.ScrapeRequest, _
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
func (h *hook) Stop() stop.Result {
|
||||
if st, isOk := h.hashContainer.(stop.Stopper); isOk {
|
||||
return st.Stop()
|
||||
func (h *hook) Close() (err error) {
|
||||
if cl, isOk := h.hashContainer.(io.Closer); isOk {
|
||||
err = cl.Close()
|
||||
}
|
||||
return stop.AlreadyStopped
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user