mirror of
https://github.com/matrix-construct/construct
synced 2025-01-19 19:11:53 +01:00
ircd::server: Tweak the link selection algorithm; comments.
This commit is contained in:
parent
e7eb5a62c7
commit
bb6bc40891
1 changed files with 5 additions and 3 deletions
|
@ -836,20 +836,22 @@ ircd::server::peer::link_get(const request &request)
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When we've reached the max number of links we return the best.
|
||||||
if(links_maxed)
|
if(links_maxed)
|
||||||
return best;
|
return best;
|
||||||
|
|
||||||
// best might not be good enough, we could try another connection. If best
|
// If no best was found or was nulled, we have room for another link.
|
||||||
// has a backlog or is working on a large download or slow request.
|
|
||||||
if(!best)
|
if(!best)
|
||||||
{
|
{
|
||||||
best = &link_add();
|
best = &link_add();
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(best->tag_uncommitted() < best->tag_commit_max())
|
// If the best has room in its pipe we give it a shot.
|
||||||
|
if(best->tag_committed() < best->tag_commit_max())
|
||||||
return best;
|
return best;
|
||||||
|
|
||||||
|
// Otherwise create a new link.
|
||||||
best = &link_add();
|
best = &link_add();
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue