diff options
-rw-r--r-- | bittorrent.cabal | 1 | ||||
-rw-r--r-- | src/Network/BitTorrent/DHT/ContactInfo.hs | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal index cc45e4c6..c9e04909 100644 --- a/bittorrent.cabal +++ b/bittorrent.cabal | |||
@@ -63,6 +63,7 @@ library | |||
63 | Network.BitTorrent.Core.PeerId | 63 | Network.BitTorrent.Core.PeerId |
64 | Network.BitTorrent.Core.PeerAddr | 64 | Network.BitTorrent.Core.PeerAddr |
65 | Network.BitTorrent.DHT | 65 | Network.BitTorrent.DHT |
66 | Network.BitTorrent.DHT.ContactInfo | ||
66 | Network.BitTorrent.DHT.Message | 67 | Network.BitTorrent.DHT.Message |
67 | Network.BitTorrent.DHT.Query | 68 | Network.BitTorrent.DHT.Query |
68 | Network.BitTorrent.DHT.Routing | 69 | Network.BitTorrent.DHT.Routing |
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 | } | ||