From c1b4289459faa1fd0c982472d3eeaa2d772fbfdf Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Wed, 26 Feb 2014 08:19:44 +0400 Subject: Add new peer store datatype --- src/Network/BitTorrent/DHT/ContactInfo.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Network/BitTorrent/DHT/ContactInfo.hs (limited to 'src/Network/BitTorrent/DHT') 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 @@ +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] + } -- cgit v1.2.3