mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +00:00
ws: refactor, bug fixes, improvements (#155)
- split swarm worker into two modules - split socket worker into two modules - keep track of which offers peers have sent and only allow matching answers - always clean up after closing connection - use channel for telling connections to close - move some logic into new ConnectionRunner struct - use slotmap for connection reference storage - fix double counting of error responses - actually close connections that take too long to send responses to - remove announced_info_hashes entry on AnnounceEvent::Stopped
This commit is contained in:
parent
af9d5a55f6
commit
fe5ccf6646
19 changed files with 1770 additions and 1583 deletions
|
|
@ -30,10 +30,10 @@ struct Peer<I: Ip> {
|
|||
}
|
||||
|
||||
impl<I: Ip> Peer<I> {
|
||||
fn to_response_peer(&self) -> ResponsePeer<I> {
|
||||
fn to_response_peer(_: &PeerId, peer: &Self) -> ResponsePeer<I> {
|
||||
ResponsePeer {
|
||||
ip_address: self.ip_address,
|
||||
port: self.port,
|
||||
ip_address: peer.ip_address,
|
||||
port: peer.port,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -352,7 +352,7 @@ mod tests {
|
|||
|
||||
if i == 0 {
|
||||
opt_sender_key = Some(key);
|
||||
opt_sender_peer = Some(peer.to_response_peer());
|
||||
opt_sender_peer = Some(Peer::to_response_peer(&key, &peer));
|
||||
}
|
||||
|
||||
peer_map.insert(key, peer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue