Merge remote-tracking branch 'origin/master'

This commit is contained in:
YouROK
2021-05-08 21:55:40 +03:00
5 changed files with 6 additions and 11 deletions

View File

@@ -15,7 +15,7 @@ func Preconfig(dkill bool) {
signal.Notify(sigc, signal.Notify(sigc,
syscall.SIGHUP, syscall.SIGHUP,
syscall.SIGINT, syscall.SIGINT,
syscall.SIGSTOP,
syscall.SIGPIPE, syscall.SIGPIPE,
syscall.SIGTERM, syscall.SIGTERM,
syscall.SIGQUIT) syscall.SIGQUIT)

View File

@@ -4,8 +4,9 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
bolt "go.etcd.io/bbolt"
"server/log" "server/log"
bolt "go.etcd.io/bbolt"
) )
type TDB struct { type TDB struct {
@@ -99,7 +100,6 @@ func (v *TDB) Set(xpath, name string, value []byte) {
log.TLogln("value:", value) log.TLogln("value:", value)
} }
return
} }
func (v *TDB) List(xpath string) []string { func (v *TDB) List(xpath string) []string {
@@ -173,5 +173,4 @@ func (v *TDB) Rem(xpath, name string) {
log.TLogln("Error rem sets", xpath+"/"+name, ", error:", err) log.TLogln("Error rem sets", xpath+"/"+name, ", error:", err)
} }
return
} }

View File

@@ -101,9 +101,7 @@ func (c *Cache) Piece(m metainfo.Piece) storage.PieceImpl {
func (c *Cache) Close() error { func (c *Cache) Close() error {
log.TLogln("Close cache for:", c.hash) log.TLogln("Close cache for:", c.hash)
if _, ok := c.storage.caches[c.hash]; ok { delete(c.storage.caches, c.hash)
delete(c.storage.caches, c.hash)
}
c.pieces = nil c.pieces = nil
c.muReaders.Lock() c.muReaders.Lock()

View File

@@ -359,9 +359,7 @@ func (t *Torrent) Close() {
t.Stat = state.TorrentClosed t.Stat = state.TorrentClosed
t.bt.mu.Lock() t.bt.mu.Lock()
if _, ok := t.bt.torrents[t.Hash()]; ok { delete(t.bt.torrents, t.Hash())
delete(t.bt.torrents, t.Hash())
}
t.bt.mu.Unlock() t.bt.mu.Unlock()
t.drop() t.drop()

View File

@@ -211,5 +211,5 @@ func streamNoAuth(c *gin.Context) {
} }
c.Header("WWW-Authenticate", "Basic realm=Authorization Required") c.Header("WWW-Authenticate", "Basic realm=Authorization Required")
c.AbortWithStatus(http.StatusUnauthorized) c.AbortWithStatus(http.StatusUnauthorized)
return
} }