Merge remote-tracking branch 'origin/master'

This commit is contained in:
YouROK
2021-03-08 21:08:00 +03:00
6 changed files with 158 additions and 18 deletions

View File

@@ -73,6 +73,7 @@ func GetTorrent(hashHex string) *Torrent {
if tr != nil {
tr.Title = tor.Title
tr.Poster = tor.Poster
tr.Data = tor.Data
tr.Size = tor.Size
tr.Timestamp = tor.Timestamp
tr.GotInfo()
@@ -128,6 +129,15 @@ func SetSettings(set *sets.BTSets) {
bts.Connect()
}
func SetDefSettings() {
if sets.ReadOnly {
return
}
bts.Disconnect()
sets.SetDefault()
bts.Connect()
}
func Shutdown() {
bts.Disconnect()
sets.CloseDB()

View File

@@ -46,20 +46,6 @@ func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter
reader := t.NewReader(file)
//off := int64(0)
//buf := make([]byte, 32*1024)
//for true {
// n, err := reader.Read(buf)
// if err != nil {
// fmt.Println("error read", err)
// break
// }
// off = off + int64(n)
// if off%(200*1024*1024) == 0 {
// time.Sleep(time.Second * 15)
// }
//}
log.Println("Connect client")
sets.SetViewed(&sets.Viewed{t.Hash().HexString(), fileID})