summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Peer.hs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-07-14 19:34:36 +0400
committerSam T <pxqr.sta@gmail.com>2013-07-14 19:34:36 +0400
commit4427cb321a6927b2dd8119e95e09f4998ff8a226 (patch)
treeed29b1a0ddcc3113cbe3d68d70413cc8239f5642 /src/Network/BitTorrent/Peer.hs
parent5cd492bc9e7ebbaa9557f7a6ae15582febd60a7d (diff)
~ Use timestamp peer Id generator.
Diffstat (limited to 'src/Network/BitTorrent/Peer.hs')
-rw-r--r--src/Network/BitTorrent/Peer.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Peer.hs b/src/Network/BitTorrent/Peer.hs
index cdcd65ea..7bac336b 100644
--- a/src/Network/BitTorrent/Peer.hs
+++ b/src/Network/BitTorrent/Peer.hs
@@ -196,6 +196,8 @@ timestamp = (BC.pack . format) <$> getCurrentTime
196entropy :: IO ByteString 196entropy :: IO ByteString
197entropy = getEntropy 15 197entropy = getEntropy 15
198 198
199-- NOTE: entropy generates incorrrect peer id
200
199-- | Here we use Azureus-style encoding with the following args: 201-- | Here we use Azureus-style encoding with the following args:
200-- 202--
201-- * 'HS' for the client id. 203-- * 'HS' for the client id.
@@ -205,7 +207,7 @@ entropy = getEntropy 15
205-- * UTC time day ++ day time for the random number. 207-- * UTC time day ++ day time for the random number.
206-- 208--
207genPeerId :: IO PeerId 209genPeerId :: IO PeerId
208genPeerId = azureusStyle defaultClientId defaultVersionNumber <$> entropy 210genPeerId = azureusStyle defaultClientId defaultVersionNumber <$> timestamp
209 211
210-- | Pad bytestring so it's becomes exactly request length. Conversion 212-- | Pad bytestring so it's becomes exactly request length. Conversion
211-- is done like so: 213-- is done like so: