fix: do not re-search for other channels when doing initial channel search
When creating a large number of Channels at once, we can end up calling `ContextImpl::poke(true)` many times in quick succession. This results in a flood of UDP broadcasts where we are searching for channels that we only just sent out the initial search request for. This can easily lead to packets getting lost and us not receiving a reply for some Channels. Moreover, as we keep resending search requests for Channels, we reschedule them further and further in the future (as `nSearch` is increased). After the dust settles and we stop poking, this can result in a wait of several seconds before a Channel which we have not found is searched for again. In this commit we avoid this issue by using a separate bucket to hold channels waiting for their initial search request. Rather than poking `tickSearch` to do the initial search and also resend requests for outstanding channels, we schedule a call to new call `tickSearch` which will only send the initial search requests. As such, we will avoid rebroadcasting search requests for channels we have only just searched for. We have prompted the `discover` bool to an enum to distinguish between the now three different situations `tickSearch` can be called in.
This commit is contained in:
committed by
Michael Davidsaver
parent
ad9ba0f085
commit
7ae659678f
@@ -93,7 +93,7 @@ std::shared_ptr<Operation> DiscoverBuilder::exec()
|
||||
if(first && ping) {
|
||||
log_debug_printf(setup, "Starting Discover%s", "\n");
|
||||
|
||||
context->tickSearch(true);
|
||||
context->tickSearch(ContextImpl::SearchKind::discover);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user