Skip to content
Snippets Groups Projects
Commit 92df1f5a authored by Adrien Béraud's avatar Adrien Béraud
Browse files

dht: recompute step time for existing searches

parent 8cce5cd6
Branches
Tags
No related merge requests found
...@@ -1138,13 +1138,15 @@ Dht::search(const InfoHash& id, sa_family_t af, GetCallback callback, DoneCallba ...@@ -1138,13 +1138,15 @@ Dht::search(const InfoHash& id, sa_family_t af, GetCallback callback, DoneCallba
if (search_id == 0) if (search_id == 0)
search_id++; search_id++;
} }
if (not sr->nextSearchStep)
sr->nextSearchStep = scheduler.add(scheduler.time(), std::bind(&Dht::searchStep, this, sr));
if (callback) if (callback)
sr->callbacks.push_back({.start=scheduler.time(), .filter=filter, .get_cb=callback, .done_cb=done_callback}); sr->callbacks.push_back({.start=scheduler.time(), .filter=filter, .get_cb=callback, .done_cb=done_callback});
bootstrapSearch(*sr); bootstrapSearch(*sr);
if (sr->nextSearchStep)
scheduler.edit(sr->nextSearchStep, sr->getNextStepTime(types, scheduler.time()));
else
sr->nextSearchStep = scheduler.add(scheduler.time(), std::bind(&Dht::searchStep, this, sr));
return sr; return sr;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment