mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
Renaming variables to better reflect what they do. (#1660)
Because bound IPv4 is hardly ever a public address. Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
d2473f4c2f
commit
1194b88258
2 changed files with 20 additions and 20 deletions
|
@ -148,19 +148,19 @@ static void close_bindinfo(struct tr_bindinfo* b)
|
||||||
|
|
||||||
static void close_incoming_peer_port(tr_session* session)
|
static void close_incoming_peer_port(tr_session* session)
|
||||||
{
|
{
|
||||||
close_bindinfo(session->public_ipv4);
|
close_bindinfo(session->bind_ipv4);
|
||||||
close_bindinfo(session->public_ipv6);
|
close_bindinfo(session->bind_ipv6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_incoming_peer_port(tr_session* session)
|
static void free_incoming_peer_port(tr_session* session)
|
||||||
{
|
{
|
||||||
close_bindinfo(session->public_ipv4);
|
close_bindinfo(session->bind_ipv4);
|
||||||
tr_free(session->public_ipv4);
|
tr_free(session->bind_ipv4);
|
||||||
session->public_ipv4 = NULL;
|
session->bind_ipv4 = NULL;
|
||||||
|
|
||||||
close_bindinfo(session->public_ipv6);
|
close_bindinfo(session->bind_ipv6);
|
||||||
tr_free(session->public_ipv6);
|
tr_free(session->bind_ipv6);
|
||||||
session->public_ipv6 = NULL;
|
session->bind_ipv6 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void accept_incoming_peer(evutil_socket_t fd, short what, void* vsession)
|
static void accept_incoming_peer(evutil_socket_t fd, short what, void* vsession)
|
||||||
|
@ -193,7 +193,7 @@ static void open_incoming_peer_port(tr_session* session)
|
||||||
struct tr_bindinfo* b;
|
struct tr_bindinfo* b;
|
||||||
|
|
||||||
/* bind an ipv4 port to listen for incoming peers... */
|
/* bind an ipv4 port to listen for incoming peers... */
|
||||||
b = session->public_ipv4;
|
b = session->bind_ipv4;
|
||||||
b->socket = tr_netBindTCP(&b->addr, session->private_peer_port, false);
|
b->socket = tr_netBindTCP(&b->addr, session->private_peer_port, false);
|
||||||
|
|
||||||
if (b->socket != TR_BAD_SOCKET)
|
if (b->socket != TR_BAD_SOCKET)
|
||||||
|
@ -205,7 +205,7 @@ static void open_incoming_peer_port(tr_session* session)
|
||||||
/* and do the exact same thing for ipv6, if it's supported... */
|
/* and do the exact same thing for ipv6, if it's supported... */
|
||||||
if (tr_net_hasIPv6(session->private_peer_port))
|
if (tr_net_hasIPv6(session->private_peer_port))
|
||||||
{
|
{
|
||||||
b = session->public_ipv6;
|
b = session->bind_ipv6;
|
||||||
b->socket = tr_netBindTCP(&b->addr, session->private_peer_port, false);
|
b->socket = tr_netBindTCP(&b->addr, session->private_peer_port, false);
|
||||||
|
|
||||||
if (b->socket != TR_BAD_SOCKET)
|
if (b->socket != TR_BAD_SOCKET)
|
||||||
|
@ -224,12 +224,12 @@ tr_address const* tr_sessionGetPublicAddress(tr_session const* session, int tr_a
|
||||||
switch (tr_af_type)
|
switch (tr_af_type)
|
||||||
{
|
{
|
||||||
case TR_AF_INET:
|
case TR_AF_INET:
|
||||||
bindinfo = session->public_ipv4;
|
bindinfo = session->bind_ipv4;
|
||||||
default_value = TR_DEFAULT_BIND_ADDRESS_IPV4;
|
default_value = TR_DEFAULT_BIND_ADDRESS_IPV4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TR_AF_INET6:
|
case TR_AF_INET6:
|
||||||
bindinfo = session->public_ipv6;
|
bindinfo = session->bind_ipv6;
|
||||||
default_value = TR_DEFAULT_BIND_ADDRESS_IPV6;
|
default_value = TR_DEFAULT_BIND_ADDRESS_IPV6;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -473,8 +473,8 @@ void tr_sessionGetSettings(tr_session* s, tr_variant* d)
|
||||||
tr_variantDictAddBool(d, TR_KEY_speed_limit_up_enabled, tr_sessionIsSpeedLimited(s, TR_UP));
|
tr_variantDictAddBool(d, TR_KEY_speed_limit_up_enabled, tr_sessionIsSpeedLimited(s, TR_UP));
|
||||||
tr_variantDictAddInt(d, TR_KEY_umask, s->umask);
|
tr_variantDictAddInt(d, TR_KEY_umask, s->umask);
|
||||||
tr_variantDictAddInt(d, TR_KEY_upload_slots_per_torrent, s->uploadSlotsPerTorrent);
|
tr_variantDictAddInt(d, TR_KEY_upload_slots_per_torrent, s->uploadSlotsPerTorrent);
|
||||||
tr_variantDictAddStr(d, TR_KEY_bind_address_ipv4, tr_address_to_string(&s->public_ipv4->addr));
|
tr_variantDictAddStr(d, TR_KEY_bind_address_ipv4, tr_address_to_string(&s->bind_ipv4->addr));
|
||||||
tr_variantDictAddStr(d, TR_KEY_bind_address_ipv6, tr_address_to_string(&s->public_ipv6->addr));
|
tr_variantDictAddStr(d, TR_KEY_bind_address_ipv6, tr_address_to_string(&s->bind_ipv6->addr));
|
||||||
tr_variantDictAddBool(d, TR_KEY_start_added_torrents, !tr_sessionGetPaused(s));
|
tr_variantDictAddBool(d, TR_KEY_start_added_torrents, !tr_sessionGetPaused(s));
|
||||||
tr_variantDictAddBool(d, TR_KEY_trash_original_torrent_files, tr_sessionGetDeleteSource(s));
|
tr_variantDictAddBool(d, TR_KEY_trash_original_torrent_files, tr_sessionGetDeleteSource(s));
|
||||||
tr_variantDictAddInt(d, TR_KEY_anti_brute_force_threshold, tr_sessionGetAntiBruteForceThreshold(s));
|
tr_variantDictAddInt(d, TR_KEY_anti_brute_force_threshold, tr_sessionGetAntiBruteForceThreshold(s));
|
||||||
|
@ -794,7 +794,7 @@ static void tr_sessionInitImpl(void* vdata)
|
||||||
|
|
||||||
if (session->isLPDEnabled)
|
if (session->isLPDEnabled)
|
||||||
{
|
{
|
||||||
tr_lpdInit(session, &session->public_ipv4->addr);
|
tr_lpdInit(session, &session->bind_ipv4->addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
@ -994,7 +994,7 @@ static void sessionSetImpl(void* vdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.socket = TR_BAD_SOCKET;
|
b.socket = TR_BAD_SOCKET;
|
||||||
session->public_ipv4 = tr_memdup(&b, sizeof(struct tr_bindinfo));
|
session->bind_ipv4 = tr_memdup(&b, sizeof(struct tr_bindinfo));
|
||||||
|
|
||||||
if (!tr_variantDictFindStr(settings, TR_KEY_bind_address_ipv6, &str, NULL) ||
|
if (!tr_variantDictFindStr(settings, TR_KEY_bind_address_ipv6, &str, NULL) ||
|
||||||
!tr_address_from_string(&b.addr, str) ||
|
!tr_address_from_string(&b.addr, str) ||
|
||||||
|
@ -1004,7 +1004,7 @@ static void sessionSetImpl(void* vdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.socket = TR_BAD_SOCKET;
|
b.socket = TR_BAD_SOCKET;
|
||||||
session->public_ipv6 = tr_memdup(&b, sizeof(struct tr_bindinfo));
|
session->bind_ipv6 = tr_memdup(&b, sizeof(struct tr_bindinfo));
|
||||||
|
|
||||||
/* incoming peer port */
|
/* incoming peer port */
|
||||||
if (tr_variantDictFindInt(settings, TR_KEY_peer_port_random_low, &i))
|
if (tr_variantDictFindInt(settings, TR_KEY_peer_port_random_low, &i))
|
||||||
|
@ -2342,7 +2342,7 @@ static void toggleLPDImpl(void* data)
|
||||||
|
|
||||||
if (session->isLPDEnabled)
|
if (session->isLPDEnabled)
|
||||||
{
|
{
|
||||||
tr_lpdInit(session, &session->public_ipv4->addr);
|
tr_lpdInit(session, &session->bind_ipv4->addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,8 +223,8 @@ struct tr_session
|
||||||
|
|
||||||
uint16_t idleLimitMinutes;
|
uint16_t idleLimitMinutes;
|
||||||
|
|
||||||
struct tr_bindinfo* public_ipv4;
|
struct tr_bindinfo* bind_ipv4;
|
||||||
struct tr_bindinfo* public_ipv6;
|
struct tr_bindinfo* bind_ipv6;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline tr_port tr_sessionGetPublicPeerPort(tr_session const* session)
|
static inline tr_port tr_sessionGetPublicPeerPort(tr_session const* session)
|
||||||
|
|
Loading…
Reference in a new issue