summaryrefslogtreecommitdiffstats
path: root/src/dht.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht.c')
-rw-r--r--src/dht.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dht.c b/src/dht.c
index ba87fb7..8a5c107 100644
--- a/src/dht.c
+++ b/src/dht.c
@@ -1330,10 +1330,10 @@ void oom (struct dht * d) {
while (drop && (drop->type || drop->dl))
drop = drop->prev;
struct torrent * old = drop;
- remove_torrent(d, old);
if (!drop)
break;
drop = drop->prev;
+ remove_torrent(d, old);
}
}
@@ -2306,7 +2306,7 @@ void periodic (struct dht * d) {
c = rand() % c;
while (n && c--)
n = n->next;
- if (n && sent < 3) { // we pick some consecutive at random and ping them.
+ while (n && sent < 3) { // we pick some consecutive at random and ping them.
sent++; // increase to more than this if desired ... idk this is shit
if (!n->unanswered)
n->last_sent = seconds();
@@ -2316,7 +2316,7 @@ void periodic (struct dht * d) {
if (!n && !t->nodes->unanswered) // if unanswered, we already sent it
n = t->nodes;
}
- if (sent < 2) {
+ while (sent < 2) {
#define RTGP(buckets) {struct bucket * b = d->buckets; \
find(t->hash, &b, NULL); \
struct node * n = b->nodes; \
@@ -2335,7 +2335,7 @@ void periodic (struct dht * d) {
RTGP(buckets);
RTGP(buckets6);
}
- if (sent < 1) {
+ while (sent < 1) {
struct bucket * b = d->buckets;
while (sent < 1 && b) {
n = b->nodes;
@@ -2344,7 +2344,7 @@ void periodic (struct dht * d) {
c = rand() % c;
while (n && c--)
n = n->next;
- if (sent < 1 && n) {
+ while (sent < 1 && n) {
sent++;
if (!n->unanswered)
n->last_sent = seconds();