summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-26 08:19:44 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-26 08:19:44 +0400
commitc1b4289459faa1fd0c982472d3eeaa2d772fbfdf (patch)
tree4e126459f0bb0969d53ba0cfdfff95edfeb8c538 /src
parentb3599a62f92a52a3ee2704e1143b65151e4e3142 (diff)
Add new peer store datatype
Diffstat (limited to 'src')
-rw-r--r--src/Network/BitTorrent/DHT/ContactInfo.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT/ContactInfo.hs b/src/Network/BitTorrent/DHT/ContactInfo.hs
new file mode 100644
index 00000000..06d2dac0
--- /dev/null
+++ b/src/Network/BitTorrent/DHT/ContactInfo.hs
@@ -0,0 +1,18 @@
1module Network.BitTorrent.DHT.ContactInfo () where
2import Data.HashMap.Strict as HM
3
4import Data.Torrent.InfoHash
5import Network.BitTorrent.Core
6
7-- increase prefix when table is too large
8-- decrease prefix when table is too small
9-- filter outdated peers
10
11data ContactInfo ip = PeerStore
12 { maxSize :: Int
13 , prefixSize :: Int
14 , thisNodeId :: NodeId
15
16 , count :: Int -- ^ Cached size of the 'peerSet'
17 , peerSet :: HashMap InfoHash [PeerAddr ip]
18 }