diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-26 08:19:44 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-26 08:19:44 +0400 |
commit | c1b4289459faa1fd0c982472d3eeaa2d772fbfdf (patch) | |
tree | 4e126459f0bb0969d53ba0cfdfff95edfeb8c538 /src | |
parent | b3599a62f92a52a3ee2704e1143b65151e4e3142 (diff) |
Add new peer store datatype
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/DHT/ContactInfo.hs | 18 |
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 @@ | |||
1 | module Network.BitTorrent.DHT.ContactInfo () where | ||
2 | import Data.HashMap.Strict as HM | ||
3 | |||
4 | import Data.Torrent.InfoHash | ||
5 | import 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 | |||
11 | data 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 | } | ||