mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge branch 'old-engine'
This commit is contained in:
@@ -94,8 +94,8 @@ func (bt *BTServer) configure(ctx context.Context) {
|
||||
bt.config.DisableTCP = settings.BTsets.DisableTCP
|
||||
bt.config.DisableUTP = settings.BTsets.DisableUTP
|
||||
// https://github.com/anacrolix/torrent/issues/703
|
||||
bt.config.DisableWebtorrent = true // TODO: check memory usage
|
||||
bt.config.DisableWebseeds = false
|
||||
// bt.config.DisableWebtorrent = true // TODO: check memory usage
|
||||
// bt.config.DisableWebseeds = false
|
||||
bt.config.NoDefaultPortForwarding = settings.BTsets.DisableUPNP
|
||||
bt.config.NoDHT = settings.BTsets.DisableDHT
|
||||
bt.config.DisablePEX = settings.BTsets.DisablePEX
|
||||
@@ -109,10 +109,13 @@ func (bt *BTServer) configure(ctx context.Context) {
|
||||
bt.config.EstablishedConnsPerTorrent = settings.BTsets.ConnectionsLimit
|
||||
bt.config.TotalHalfOpenConns = 500
|
||||
// Encryption/Obfuscation
|
||||
bt.config.HeaderObfuscationPolicy = torrent.HeaderObfuscationPolicy{
|
||||
RequirePreferred: settings.BTsets.ForceEncrypt,
|
||||
Preferred: true,
|
||||
bt.config.EncryptionPolicy = torrent.EncryptionPolicy{
|
||||
ForceEncryption: settings.BTsets.ForceEncrypt,
|
||||
}
|
||||
// bt.config.HeaderObfuscationPolicy = torrent.HeaderObfuscationPolicy{
|
||||
// RequirePreferred: settings.BTsets.ForceEncrypt,
|
||||
// Preferred: true,
|
||||
// }
|
||||
if settings.BTsets.DownloadRateLimit > 0 {
|
||||
bt.config.DownloadRateLimiter = utils.Limit(settings.BTsets.DownloadRateLimit * 1024)
|
||||
}
|
||||
|
||||
@@ -25,20 +25,20 @@ func NewStorage(capacity int64) *Storage {
|
||||
}
|
||||
|
||||
func (s *Storage) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (ts.TorrentImpl, error) {
|
||||
capFunc := func() (int64, bool) {
|
||||
return s.capacity, true
|
||||
}
|
||||
// capFunc := func() (int64, bool) {
|
||||
// return s.capacity, true
|
||||
// }
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
ch := NewCache(s.capacity, s)
|
||||
ch.Init(info, infoHash)
|
||||
s.caches[infoHash] = ch
|
||||
// return ch, nil
|
||||
return ts.TorrentImpl{
|
||||
Piece: ch.Piece,
|
||||
Close: ch.Close,
|
||||
Capacity: &capFunc,
|
||||
}, nil
|
||||
return ch, nil
|
||||
// return ts.TorrentImpl{
|
||||
// Piece: ch.Piece,
|
||||
// Close: ch.Close,
|
||||
// Capacity: &capFunc,
|
||||
// }, nil
|
||||
}
|
||||
|
||||
func (s *Storage) CloseHash(hash metainfo.Hash) {
|
||||
|
||||
Reference in New Issue
Block a user