(trunk libT) committed patfch from gornack (proofed by juliusz) for ticket #2312 to use the bind-address-ipv4 setting in the DHT announce

This commit is contained in:
Charles Kerr 2009-08-07 14:47:46 +00:00
parent 1419d4b8a1
commit 5d1f1eb8ce
3 changed files with 5 additions and 4 deletions

View File

@ -848,7 +848,7 @@ tr_sessionInitImpl( void * vdata )
#ifdef WITHOUT_DHT
tr_inf( "DHT disabled by packager." );
#else
tr_dhtInit( session );
tr_dhtInit( session, &session->public_ipv4->addr );
#endif
}
}
@ -1633,7 +1633,7 @@ toggleDHTImpl( void * data )
session->isDHTEnabled = !session->isDHTEnabled;
if( session->isDHTEnabled )
tr_dhtInit( session );
tr_dhtInit( session, &session->public_ipv4->addr );
}
void

View File

@ -119,7 +119,7 @@ dht_bootstrap(void *closure)
}
int
tr_dhtInit(tr_session *ss)
tr_dhtInit(tr_session *ss, tr_address * tr_addr)
{
struct sockaddr_in sin;
tr_benc benc;
@ -146,6 +146,7 @@ tr_dhtInit(tr_session *ss)
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
memcpy(&(sin.sin_addr), &(tr_addr->addr.addr4), sizeof (struct in_addr));
sin.sin_port = htons(dht_port);
rc = bind(dht_socket, (struct sockaddr*)&sin, sizeof(sin));
if(rc < 0)

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#define TR_DHT_FIREWALLED 3
#define TR_DHT_GOOD 4
int tr_dhtInit( tr_session * );
int tr_dhtInit( tr_session *, tr_address * );
void tr_dhtUninit( tr_session * );
tr_bool tr_dhtEnabled( const tr_session * );
tr_port tr_dhtPort ( const tr_session * );