]> Sergey Matveev's repositories - btrtrc.git/commitdiff
cmd/torrent: Respect default client max unverified bytes
authorMatt Joiner <anacrolix@gmail.com>
Wed, 11 May 2022 10:23:14 +0000 (20:23 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 12 May 2022 00:37:36 +0000 (10:37 +1000)
cmd/torrent/download.go

index 45164a3f8b6b4b1780d5e4014ad84527b8d1feb4..cd487edb36ac4c941feeb0b0546adc78e19b548d 100644 (file)
@@ -242,7 +242,7 @@ type DownloadCmd struct {
        Mmap               bool           `help:"memory-map torrent data"`
        Seed               bool           `help:"seed after download is complete"`
        Addr               string         `help:"network listen addr"`
-       MaxUnverifiedBytes tagflag.Bytes  `help:"maximum number bytes to have pending verification"`
+       MaxUnverifiedBytes *tagflag.Bytes `help:"maximum number bytes to have pending verification"`
        UploadRate         *tagflag.Bytes `help:"max piece bytes to send per second"`
        DownloadRate       *tagflag.Bytes `help:"max bytes per second down from peers"`
        PackedBlocklist    string
@@ -324,7 +324,9 @@ func downloadErr(flags downloadFlags) error {
        if flags.RequireFastExtension {
                clientConfig.MinPeerExtensions.SetBit(pp.ExtensionBitFast, true)
        }
-       clientConfig.MaxUnverifiedBytes = flags.MaxUnverifiedBytes.Int64()
+       if flags.MaxUnverifiedBytes != nil {
+               clientConfig.MaxUnverifiedBytes = flags.MaxUnverifiedBytes.Int64()
+       }
 
        ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
        defer cancel()