summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT/ContactInfo.hs
blob: 06d2dac098c17cbbd2a89b2493c1d0875f5e9e2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Network.BitTorrent.DHT.ContactInfo () where
import Data.HashMap.Strict as HM

import Data.Torrent.InfoHash
import Network.BitTorrent.Core

-- increase prefix when table is too large
-- decrease prefix when table is too small
-- filter outdated peers

data ContactInfo ip = PeerStore
  { maxSize    :: Int
  , prefixSize :: Int
  , thisNodeId :: NodeId

  , count      :: Int  -- ^ Cached size of the 'peerSet'
  , peerSet    :: HashMap InfoHash [PeerAddr ip]
  }