mirror of
https://github.com/transmission/transmission
synced 2025-01-04 05:56:02 +00:00
dfe79af34c
* refactor: remove effective-url caching in webseeds The upcoming CURLSH refactor is a more effective way of doing this and the current appoach makes tr_web harder to refactor, so remove it. * refactor: webseed rate limiting The current code that limits the number of parallel fetches is overly complicated and is also interwoven into the tr_webseed class. Extract it into a new private helper class "ConnectionLimiter" with a simpler public API for tr_webseed to use.
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// This file Copyright © 2021-2022 Mnemosyne LLC.
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
// License text can be found in the licenses/ folder.
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string_view>
|
|
|
|
#include "transmission.h"
|
|
|
|
struct evbuffer;
|
|
struct tr_address;
|
|
struct tr_web_task;
|
|
|
|
enum tr_web_close_mode
|
|
{
|
|
TR_WEB_CLOSE_WHEN_IDLE,
|
|
TR_WEB_CLOSE_NOW
|
|
};
|
|
|
|
void tr_webClose(tr_session* session, tr_web_close_mode close_mode);
|
|
|
|
using tr_web_done_func = void (*)(
|
|
tr_session* session,
|
|
bool did_connect_flag,
|
|
bool timeout_flag,
|
|
long response_code,
|
|
std::string_view response,
|
|
void* user_data);
|
|
|
|
struct tr_web_task* tr_webRun(tr_session* session, std::string_view url, tr_web_done_func done_func, void* done_func_user_data);
|
|
|
|
struct tr_web_task* tr_webRunWithCookies(
|
|
tr_session* session,
|
|
std::string_view url,
|
|
std::string_view cookies,
|
|
tr_web_done_func done_func,
|
|
void* done_func_user_data);
|
|
|
|
struct tr_web_task* tr_webRunWebseed(
|
|
tr_torrent* tor,
|
|
std::string_view url,
|
|
std::string_view range,
|
|
tr_web_done_func done_func,
|
|
void* done_func_user_data,
|
|
struct evbuffer* buffer);
|
|
|
|
long tr_webGetTaskResponseCode(struct tr_web_task* task);
|