1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 07:42:37 +00:00

fix: don't double count webseed download data rate (#7235)

Regression from f1a53840f9
This commit is contained in:
Yat Ho 2024-11-07 03:55:58 +08:00 committed by GitHub
parent 2315903015
commit f1102f0b4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 0 additions and 18 deletions

View file

@ -341,16 +341,6 @@ size_t tr_session::WebMediator::clamp(int torrent_id, size_t byte_count) const
return tor == nullptr ? 0U : tor->bandwidth().clamp(TR_DOWN, byte_count);
}
void tr_session::WebMediator::notifyBandwidthConsumed(int torrent_id, size_t byte_count)
{
auto const lock = session_->unique_lock();
if (auto* const tor = session_->torrents().get(torrent_id); tor != nullptr)
{
tor->bandwidth().notify_bandwidth_consumed(TR_DOWN, byte_count, true, tr_time_msec());
}
}
void tr_session::WebMediator::run(tr_web::FetchDoneFunc&& func, tr_web::FetchResponse&& response) const
{
session_->run_in_session_thread(std::move(func), std::move(response));

View file

@ -244,7 +244,6 @@ private:
[[nodiscard]] std::optional<std::string_view> userAgent() const override;
[[nodiscard]] size_t clamp(int torrent_id, size_t byte_count) const override;
[[nodiscard]] time_t now() const override;
void notifyBandwidthConsumed(int torrent_id, size_t byte_count) override;
// runs the tr_web::fetch response callback in the libtransmission thread
void run(tr_web::FetchDoneFunc&& func, tr_web::FetchResponse&& response) const override;

View file

@ -482,8 +482,6 @@ public:
task->impl.paused_easy_handles.emplace(task->easy(), tr_time_msec());
return CURL_WRITEFUNC_PAUSE;
}
task->impl.mediator.notifyBandwidthConsumed(*tag, bytes_used);
}
evbuffer_add(task->body(), data, bytes_used);

View file

@ -143,11 +143,6 @@ public:
return std::nullopt;
}
// Notify the system that `byte_count` of download bandwidth was used
virtual void notifyBandwidthConsumed([[maybe_unused]] int bandwidth_tag, [[maybe_unused]] size_t byte_count)
{
}
// Return the number of bytes that should be allowed. See tr_bandwidth::clamp()
[[nodiscard]] virtual size_t clamp([[maybe_unused]] int bandwidth_tag, size_t byte_count) const
{