diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-05-05 21:40:24 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-05-05 21:40:24 +0400 |
commit | 02890ad135b326d85aa5e7d188fce8fafec12fdb (patch) | |
tree | 6aa3e7f302495db8b042bfb851eaf434d5ff0ac8 /src/Network/BitTorrent/PeerWire/Message.hs | |
parent | 7f63b5554fcf31d9b71c79fa9d0ee66d2ef95c94 (diff) |
~ Fix message length bug in handshake.
Diffstat (limited to 'src/Network/BitTorrent/PeerWire/Message.hs')
-rw-r--r-- | src/Network/BitTorrent/PeerWire/Message.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/PeerWire/Message.hs b/src/Network/BitTorrent/PeerWire/Message.hs index 39102eed..1c520221 100644 --- a/src/Network/BitTorrent/PeerWire/Message.hs +++ b/src/Network/BitTorrent/PeerWire/Message.hs | |||
@@ -99,7 +99,10 @@ instance Serialize Message where | |||
99 | 0x0D -> SuggestPiece <$> getInt | 99 | 0x0D -> SuggestPiece <$> getInt |
100 | 0x10 -> RejectRequest <$> get | 100 | 0x10 -> RejectRequest <$> get |
101 | 0x11 -> AllowedFast <$> getInt | 101 | 0x11 -> AllowedFast <$> getInt |
102 | _ -> fail $ "unknown message ID: " ++ show mid | 102 | _ -> do |
103 | rm <- remaining >>= getBytes | ||
104 | fail $ "unknown message ID: " ++ show mid ++ "\n" | ||
105 | ++ "remaining available bytes: " ++ show rm | ||
103 | 106 | ||
104 | where | 107 | where |
105 | getBlock :: Int -> Get Block | 108 | getBlock :: Int -> Get Block |