Skip to content

Commit

Permalink
fix new_search function to return NULL when no search slots are avail…
Browse files Browse the repository at this point in the history
…able

The README mentions that dht_search returns -1 when too many searches
are already in progress but it could never happen because in that case
new_search was always returning the slot of a search that was still in
progress instead of return NULL.
  • Loading branch information
joel-su authored and jech committed Jul 30, 2019
1 parent 409f81c commit 2b3a636
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dht.c
Expand Up @@ -1294,8 +1294,8 @@ new_search(void)
}
}

/* Oh, well, never mind. Reuse the oldest slot. */
return oldest;
/* No available slots found, return NULL. */
return NULL;
}

/* Insert the contents of a bucket into a search structure. */
Expand Down

0 comments on commit 2b3a636

Please sign in to comment.