From b5f222ba7dfa1fa53b8b53f4e1b770193bb55fe4 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Mon, 14 Oct 2013 05:11:46 +0400 Subject: Move some modules from torrent-content --- src/Network/BitTorrent/DHT/Protocol.hs | 6 ++---- src/Network/BitTorrent/Discovery.hs | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 src/Network/BitTorrent/Discovery.hs (limited to 'src/Network') diff --git a/src/Network/BitTorrent/DHT/Protocol.hs b/src/Network/BitTorrent/DHT/Protocol.hs index 73e5fa68..0ac814b7 100644 --- a/src/Network/BitTorrent/DHT/Protocol.hs +++ b/src/Network/BitTorrent/DHT/Protocol.hs @@ -42,7 +42,7 @@ import Network.BitTorrent.Exchange.Protocol () type NodeId = ByteString --- WARN is the 'system' random suitable for this? +-- TODO WARN is the 'system' random suitable for this? -- | Generate random NodeID used for the entire session. -- Distribution of ID's should be as uniform as possible. -- @@ -56,9 +56,7 @@ data NodeAddr = NodeAddr { instance Serialize NodeAddr where get = NodeAddr <$> getWord32be <*> get - put NodeAddr {..} = do - putWord32be nodeIP - put nodePort + put NodeAddr {..} = putWord32be nodeIP >> put nodePort data NodeInfo = NodeInfo { nodeID :: !NodeId diff --git a/src/Network/BitTorrent/Discovery.hs b/src/Network/BitTorrent/Discovery.hs new file mode 100644 index 00000000..f26864a7 --- /dev/null +++ b/src/Network/BitTorrent/Discovery.hs @@ -0,0 +1,4 @@ +type PeerCount = Int + +defaultChanSize :: PeerCount +defaultChanSize = defaultNumWant * 2 -- cgit v1.2.3