#2738 Fix the IPv6 DHT broken by r10616
This commit is contained in:
parent
09ead47487
commit
ec687f14ad
|
@ -248,7 +248,7 @@ dht_bootstrap(void *closure)
|
||||||
IPv6 address, if I may say so myself. */
|
IPv6 address, if I may say so myself. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rebind_ipv6(void)
|
rebind_ipv6(tr_bool force)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 sin6;
|
struct sockaddr_in6 sin6;
|
||||||
const unsigned char *ipv6 = tr_globalIPv6();
|
const unsigned char *ipv6 = tr_globalIPv6();
|
||||||
|
@ -258,7 +258,7 @@ rebind_ipv6(void)
|
||||||
|
|
||||||
/* We currently have no way to enable or disable IPv6 once the DHT has
|
/* We currently have no way to enable or disable IPv6 once the DHT has
|
||||||
been initialised. Oh, well. */
|
been initialised. Oh, well. */
|
||||||
if(dht6_socket < 0 || ipv6 == NULL) {
|
if(ipv6 == NULL || (!force && dht6_socket < 0)) {
|
||||||
if(last_bound) {
|
if(last_bound) {
|
||||||
free(last_bound);
|
free(last_bound);
|
||||||
last_bound = NULL;
|
last_bound = NULL;
|
||||||
|
@ -342,7 +342,7 @@ tr_dhtInit(tr_session *ss, const tr_address * tr_addr)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if(tr_globalIPv6())
|
if(tr_globalIPv6())
|
||||||
rebind_ipv6();
|
rebind_ipv6(TRUE);
|
||||||
|
|
||||||
if( getenv( "TR_DHT_VERBOSE" ) != NULL )
|
if( getenv( "TR_DHT_VERBOSE" ) != NULL )
|
||||||
dht_debug = stderr;
|
dht_debug = stderr;
|
||||||
|
@ -708,7 +708,7 @@ event_callback(int s, short type, void *ignore UNUSED )
|
||||||
avoids a system call. */
|
avoids a system call. */
|
||||||
count++;
|
count++;
|
||||||
if(count >= 20) {
|
if(count >= 20) {
|
||||||
rebind_ipv6();
|
rebind_ipv6(FALSE);
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue