summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-07 05:36:37 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-07 05:36:37 +0400
commite333666cc7c4de24ec10b948afeeb3bfe1976ba1 (patch)
tree3f1a163939e6052ac18f9eb838d62d60bb53db00 /src/Network
parentfaa63b25305c94e22706a639e62d47115dd70983 (diff)
~ fix goddamn length encoding bug
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/Torrent/Handshake.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Network/Torrent/Handshake.hs b/src/Network/Torrent/Handshake.hs
index b17afaf7..c14fd591 100644
--- a/src/Network/Torrent/Handshake.hs
+++ b/src/Network/Torrent/Handshake.hs
@@ -26,7 +26,7 @@ data Handshake = Handshake {
26 26
27instance Serialize Handshake where 27instance Serialize Handshake where
28 put hs = do 28 put hs = do
29 putWord8 (49 + fromIntegral (B.length (hsProtocol hs))) 29 putWord8 (fromIntegral (B.length (hsProtocol hs)))
30 putByteString (hsProtocol hs) 30 putByteString (hsProtocol hs)
31 putWord64be (hsReserved hs) 31 putWord64be (hsReserved hs)
32 putByteString (hsInfoHash hs) 32 putByteString (hsInfoHash hs)
@@ -34,7 +34,7 @@ instance Serialize Handshake where
34 34
35 get = do 35 get = do
36 len <- getWord8 36 len <- getWord8
37 Handshake <$> getBytes (fromIntegral (len - 49)) 37 Handshake <$> getBytes (fromIntegral len)
38 <*> getWord64be 38 <*> getWord64be
39 <*> getBytes 20 39 <*> getBytes 20
40 <*> get 40 <*> get