diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/DHT/Protocol.hs | 6 | ||||
-rw-r--r-- | src/Network/BitTorrent/Discovery.hs | 4 |
2 files changed, 6 insertions, 4 deletions
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 () | |||
42 | 42 | ||
43 | type NodeId = ByteString | 43 | type NodeId = ByteString |
44 | 44 | ||
45 | -- WARN is the 'system' random suitable for this? | 45 | -- TODO WARN is the 'system' random suitable for this? |
46 | -- | Generate random NodeID used for the entire session. | 46 | -- | Generate random NodeID used for the entire session. |
47 | -- Distribution of ID's should be as uniform as possible. | 47 | -- Distribution of ID's should be as uniform as possible. |
48 | -- | 48 | -- |
@@ -56,9 +56,7 @@ data NodeAddr = NodeAddr { | |||
56 | 56 | ||
57 | instance Serialize NodeAddr where | 57 | instance Serialize NodeAddr where |
58 | get = NodeAddr <$> getWord32be <*> get | 58 | get = NodeAddr <$> getWord32be <*> get |
59 | put NodeAddr {..} = do | 59 | put NodeAddr {..} = putWord32be nodeIP >> put nodePort |
60 | putWord32be nodeIP | ||
61 | put nodePort | ||
62 | 60 | ||
63 | data NodeInfo = NodeInfo { | 61 | data NodeInfo = NodeInfo { |
64 | nodeID :: !NodeId | 62 | 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 @@ | |||
1 | type PeerCount = Int | ||
2 | |||
3 | defaultChanSize :: PeerCount | ||
4 | defaultChanSize = defaultNumWant * 2 | ||