From 6508dc3a3d6a207d54c62783df2423aa1d5e5b41 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 1 Jun 2009 18:24:30 +0000 Subject: [PATCH] (trunk libT) #2146: Incorrect maintenance of dhtAnnounceInProgress --- libtransmission/tr-dht.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.c index 2250f8cf1..897547695 100644 --- a/libtransmission/tr-dht.c +++ b/libtransmission/tr-dht.c @@ -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; }