(trunk libT) #2146: Incorrect maintenance of dhtAnnounceInProgress

This commit is contained in:
Charles Kerr 2009-06-01 18:24:30 +00:00
parent f538b08fb3
commit 6508dc3a3d
1 changed files with 8 additions and 4 deletions

View File

@ -338,17 +338,21 @@ callback( void *ignore UNUSED, int event,
int
tr_dhtAnnounce(tr_torrent *tor, tr_bool announce)
{
int rc;
if( !tr_torrentAllowsDHT( tor ) )
return -1;
if( tr_dhtStatus( tor->session, NULL ) < TR_DHT_POOR )
return 0;
dht_search( dht_socket, tor->info.hash,
announce ? tr_sessionGetPeerPort(session) : 0,
callback, NULL);
rc = dht_search( dht_socket, tor->info.hash,
announce ? tr_sessionGetPeerPort(session) : 0,
callback, NULL);
if( rc >= 1 )
tor->dhtAnnounceInProgress = TRUE;
tor->dhtAnnounceInProgress = TRUE;
return 1;
}