aquatic_ws: announce handler fixes, related changes elsewhere

This commit is contained in:
Joakim Frostegård 2020-05-08 01:57:12 +02:00
parent 7ebbb311e1
commit a39c7a5950
3 changed files with 55 additions and 8 deletions

View file

@ -14,7 +14,7 @@ pub struct ValidUntil(pub Instant);
pub struct Peer {
pub peer_id: PeerId,
pub peer_id: PeerId, // FIXME: maybe this field can be removed
pub complete: bool,
pub valid_until: ValidUntil,
pub connection_meta: ConnectionMeta,
@ -31,6 +31,17 @@ pub struct TorrentData {
}
impl Default for TorrentData {
fn default() -> Self {
Self {
peers: IndexMap::new(),
seeders: 0,
leechers: 0,
}
}
}
pub type TorrentMap = HashMap<InfoHash, TorrentData>;
@ -48,6 +59,7 @@ impl Default for State {
}
#[derive(Clone, Copy)]
pub struct ConnectionMeta {
/// Index of socket worker responsible for this connection. Required for
/// sending back response through correct channel to correct worker.