mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +00:00
udp: reuse response channel mem, add backpressure, faster peer extract
This commit is contained in:
parent
0e12dd1b13
commit
0c4140165b
15 changed files with 666 additions and 522 deletions
|
|
@ -65,14 +65,12 @@ impl PendingScrapeResponseSlab {
|
|||
|
||||
pub fn add_and_get_finished(
|
||||
&mut self,
|
||||
response: PendingScrapeResponse,
|
||||
response: &PendingScrapeResponse,
|
||||
) -> Option<ScrapeResponse> {
|
||||
let finished = if let Some(entry) = self.0.get_mut(response.slab_key) {
|
||||
entry.num_pending -= 1;
|
||||
|
||||
entry
|
||||
.torrent_stats
|
||||
.extend(response.torrent_stats.into_iter());
|
||||
entry.torrent_stats.extend(response.torrent_stats.iter());
|
||||
|
||||
entry.num_pending == 0
|
||||
} else {
|
||||
|
|
@ -205,7 +203,7 @@ mod tests {
|
|||
torrent_stats,
|
||||
};
|
||||
|
||||
if let Some(response) = map.add_and_get_finished(response) {
|
||||
if let Some(response) = map.add_and_get_finished(&response) {
|
||||
responses.push(response);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue