mirror of
https://github.com/transmission/transmission.git
synced 2025-12-25 04:45:56 +00:00
refactor: tr_web (#2640)
* fixup! refactor: tr_web (#2633) fix: race condition in web threadfunc during bootstrap fixes #2639
This commit is contained in:
@@ -1340,7 +1340,7 @@ static char const* torrentRenamePath(
|
||||
****
|
||||
***/
|
||||
|
||||
static void portTested(tr_web::FetchResponse&& web_response)
|
||||
static void onPortTested(tr_web::FetchResponse const& web_response)
|
||||
{
|
||||
auto const& [status, body, did_connect, did_tmieout, user_data] = web_response;
|
||||
char result[1024];
|
||||
@@ -1368,7 +1368,7 @@ static char const* portTest(
|
||||
{
|
||||
auto const port = tr_sessionGetPeerPort(session);
|
||||
auto const url = tr_strvJoin("https://portcheck.transmissionbt.com/"sv, std::to_string(port));
|
||||
session->web->fetch({ url, portTested, idle_data });
|
||||
session->web->fetch({ url, onPortTested, idle_data });
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1376,7 +1376,7 @@ static char const* portTest(
|
||||
****
|
||||
***/
|
||||
|
||||
static void gotNewBlocklist(tr_web::FetchResponse&& web_response)
|
||||
static void onBlocklistFetched(tr_web::FetchResponse const& web_response)
|
||||
{
|
||||
auto const& [status, body, did_connect, did_timeout, user_data] = web_response;
|
||||
auto* data = static_cast<struct tr_rpc_idle_data*>(user_data);
|
||||
@@ -1446,7 +1446,7 @@ static char const* blocklistUpdate(
|
||||
tr_variant* /*args_out*/,
|
||||
struct tr_rpc_idle_data* idle_data)
|
||||
{
|
||||
session->web->fetch({ session->blocklistUrl(), gotNewBlocklist, idle_data });
|
||||
session->web->fetch({ session->blocklistUrl(), onBlocklistFetched, idle_data });
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1501,7 +1501,7 @@ struct add_torrent_idle_data
|
||||
tr_ctor* ctor;
|
||||
};
|
||||
|
||||
static void gotMetadataFromURL(tr_web::FetchResponse&& web_response)
|
||||
static void onMetadataFetched(tr_web::FetchResponse const& web_response)
|
||||
{
|
||||
auto const& [status, body, did_connect, did_timeout, user_data] = web_response;
|
||||
auto* data = static_cast<struct add_torrent_idle_data*>(user_data);
|
||||
@@ -1520,7 +1520,7 @@ static void gotMetadataFromURL(tr_web::FetchResponse&& web_response)
|
||||
else
|
||||
{
|
||||
char result[1024];
|
||||
tr_snprintf(result, sizeof(result), "gotMetadataFromURL: http error %ld: %s", status, tr_webGetResponseStr(status));
|
||||
tr_snprintf(result, sizeof(result), "onMetadataFetched: http error %ld: %s", status, tr_webGetResponseStr(status));
|
||||
tr_idle_function_done(data->data, result);
|
||||
}
|
||||
|
||||
@@ -1656,7 +1656,7 @@ static char const* torrentAdd(tr_session* session, tr_variant* args_in, tr_varia
|
||||
d->data = idle_data;
|
||||
d->ctor = ctor;
|
||||
|
||||
auto options = tr_web::FetchOptions{ filename, gotMetadataFromURL, d };
|
||||
auto options = tr_web::FetchOptions{ filename, onMetadataFetched, d };
|
||||
options.cookies = cookies;
|
||||
session->web->fetch(std::move(options));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user