From 8f3660c3344c52ef929d2c5924703429bb19f943 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 19 May 2009 20:42:01 +0000 Subject: [PATCH] (trunk libT) fix event_callback() error in tr-dht.c --- libtransmission/tr-dht.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.c index c6302d427..c45f3f4c0 100644 --- a/libtransmission/tr-dht.c +++ b/libtransmission/tr-dht.c @@ -360,24 +360,22 @@ tr_dhtAnnounce(tr_torrent *tor, tr_bool announce) static void event_callback(int s, short type, void *ignore UNUSED ) { - int rc; time_t tosleep; struct timeval tv; - rc = dht_periodic(s, type == EV_READ, &tosleep, callback, NULL); - if(rc < 0) { + if( dht_periodic(s, type == EV_READ, &tosleep, callback, NULL) < 0 ) { if(errno == EINTR) { tosleep = 0; } else { perror("dht_periodic"); - if(rc == EINVAL || rc == EFAULT) + if(errno == EINVAL || errno == EFAULT) abort(); tosleep = 1; } } - /* Being slightly late is fine, and has the added benefit of adding - some jitter. */ + /* Being slightly late is fine, + and has the added benefit of adding some jitter. */ tv.tv_sec = tosleep; tv.tv_usec = tr_cryptoWeakRandInt( 1000000 ); event_add(&dht_event, &tv);