mirror of
https://github.com/transmission/transmission
synced 2025-01-30 10:52:00 +00:00
fix: intermediate fix for HTTP announce behaviour affected by bind-address-ipv*
(#5296)
This commit is contained in:
parent
47e141563a
commit
85a00625dc
3 changed files with 17 additions and 32 deletions
|
@ -92,8 +92,8 @@ Here is a sample of the three basic types: respectively Boolean, Number and Stri
|
|||
* **utp-enabled:** Boolean (default = true) Enable [Micro Transport Protocol (µTP)](https://en.wikipedia.org/wiki/Micro_Transport_Protocol)
|
||||
|
||||
#### Peers
|
||||
* **bind-address-ipv4:** String (default = "0.0.0.0") Where to listen for peer connections.
|
||||
* **bind-address-ipv6:** String (default = "::") Where to listen for peer connections.
|
||||
* **bind-address-ipv4:** String (default = "0.0.0.0") Where to listen for peer connections. When no valid IPv4 address is provided, Transmission will default to "0.0.0.0".
|
||||
* **bind-address-ipv6:** String (default = "::") Where to listen for peer connections. When no valid IPv6 address is provided, Transmission will determine your default public IPv6 address and use it.
|
||||
* **peer-congestion-algorithm:** String. This is documented on https://www.pps.jussieu.fr/~jch/software/bittorrent/tcp-congestion-control.html.
|
||||
* **peer-limit-global:** Number (default = 240)
|
||||
* **peer-limit-per-torrent:** Number (default = 60)
|
||||
|
|
|
@ -267,11 +267,8 @@ void tr_tracker_http_announce(
|
|||
public address they want to use.
|
||||
|
||||
We should ensure that we send the announce both via IPv6 and IPv4,
|
||||
and to be safe we also add the "ipv6=" and "ipv4=" parameters, if
|
||||
we already have them. Our global IPv6 address is computed for the
|
||||
LTEP handshake, so this comes for free. Our public IPv4 address
|
||||
may have been returned from a previous announce and stored in the
|
||||
session.
|
||||
but no longer use the "ipv4=" and "ipv6=" parameters. So, we no
|
||||
longer need to compute the global IPv4 and IPv6 addresses.
|
||||
*/
|
||||
auto url = tr_urlbuf{};
|
||||
announce_url_new(url, session, request);
|
||||
|
@ -286,8 +283,6 @@ void tr_tracker_http_announce(
|
|||
session->fetch(std::move(opt));
|
||||
};
|
||||
|
||||
auto const [ipv6, ipv6_is_any] = session->publicAddress(TR_AF_INET6);
|
||||
|
||||
/*
|
||||
* Before Curl 7.77.0, if we explicitly choose the IP version we want
|
||||
* to use, it is still possible that the wrong one is used. The workaround
|
||||
|
@ -295,7 +290,7 @@ void tr_tracker_http_announce(
|
|||
* a request that we don't know if will go through IPv6 or IPv4.
|
||||
*/
|
||||
static auto const use_curl_workaround = curl_version_info(CURLVERSION_NOW)->version_num < 0x074D00 /* 7.77.0 */;
|
||||
if (use_curl_workaround)
|
||||
if (use_curl_workaround || session->useAnnounceIP())
|
||||
{
|
||||
if (session->useAnnounceIP())
|
||||
{
|
||||
|
@ -306,17 +301,6 @@ void tr_tracker_http_announce(
|
|||
do_make_request(""sv, std::move(options));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (session->useAnnounceIP() || ipv6_is_any)
|
||||
{
|
||||
if (session->useAnnounceIP())
|
||||
{
|
||||
options.url += format_ip_arg(session->announceIP());
|
||||
}
|
||||
d->requests_sent_count = 1;
|
||||
do_make_request(""sv, std::move(options));
|
||||
}
|
||||
else
|
||||
{
|
||||
d->requests_sent_count = 2;
|
||||
|
||||
|
@ -330,7 +314,6 @@ void tr_tracker_http_announce(
|
|||
do_make_request("IPv6"sv, std::move(options));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tr_announcerParseHttpAnnounceResponse(tr_announce_response& response, std::string_view benc, std::string_view log_name)
|
||||
{
|
||||
|
|
|
@ -581,13 +581,15 @@ std::optional<tr_address> tr_address::from_string(std::string_view address_sv)
|
|||
|
||||
auto addr = tr_address{};
|
||||
|
||||
if (evutil_inet_pton(AF_INET, address_sz, &addr.addr) == 1)
|
||||
addr.addr.addr4 = {};
|
||||
if (evutil_inet_pton(AF_INET, address_sz, &addr.addr.addr4) == 1)
|
||||
{
|
||||
addr.type = TR_AF_INET;
|
||||
return addr;
|
||||
}
|
||||
|
||||
if (evutil_inet_pton(AF_INET6, address_sz, &addr.addr) == 1)
|
||||
addr.addr.addr6 = {};
|
||||
if (evutil_inet_pton(AF_INET6, address_sz, &addr.addr.addr6) == 1)
|
||||
{
|
||||
addr.type = TR_AF_INET6;
|
||||
return addr;
|
||||
|
|
Loading…
Reference in a new issue