1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// use sparse_bitfield::Bitfield;

use super::Message;

/// A peer on the network.
// omitted fields: [
//  feed,
//  stream,
//  inflightRequests,
// ]
#[derive(Debug, Clone, PartialEq)]
pub struct Peer {
  // remote_id: usize,
// remote_length: usize,
// remote_bitfield: Bitfield,
// remote_is_want: bool,
// remote_is_downloading: bool,
// is_live: bool,
// is_sparse: bool,
// is_downloading: bool,
// is_uploading: bool,
// max_requests: u16,
}

impl Peer {
  /// Check if the peer has a message.
  pub fn have(&mut self, _msg: &Message) {
    unimplemented!();
  }

  /// Tell a peer you no longer have a message.
  pub fn unhave(&mut self, _msg: &Message) {
    unimplemented!();
  }

  /// Update.
  pub fn update(&mut self) {
    unimplemented!();
  }
}