summaryrefslogtreecommitdiff
path: root/src/Network/Torrent/PeerWire/Handshake.hs
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-09 00:06:08 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-09 00:06:08 +0400
commit191a863e0cea911a8f44f25a67b31363461db42a (patch)
treecb0bd735214ece711e0e6f0a8aae4f8bf1a6d029 /src/Network/Torrent/PeerWire/Handshake.hs
parente0517ca99cfacffd9a045bdb475de4561d597fb2 (diff)
+ handshake message max size
Diffstat (limited to 'src/Network/Torrent/PeerWire/Handshake.hs')
-rw-r--r--src/Network/Torrent/PeerWire/Handshake.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Network/Torrent/PeerWire/Handshake.hs b/src/Network/Torrent/PeerWire/Handshake.hs
index ab255c14..ae65933f 100644
--- a/src/Network/Torrent/PeerWire/Handshake.hs
+++ b/src/Network/Torrent/PeerWire/Handshake.hs
@@ -1,6 +1,7 @@
1{-# LANGUAGE OverloadedStrings #-} 1{-# LANGUAGE OverloadedStrings #-}
2module Network.Torrent.PeerWire.Handshake 2module Network.Torrent.PeerWire.Handshake
3 ( Handshake 3 ( Handshake
4 , handshakeMaxSize
4 , defaultProtocol, defaultReserved, defaultHandshake 5 , defaultProtocol, defaultReserved, defaultHandshake
5 ) where 6 ) where
6 7
@@ -39,6 +40,10 @@ instance Serialize Handshake where
39 <*> get 40 <*> get
40 <*> get 41 <*> get
41 42
43-- | Maximum size of handshake message in bytes.
44handshakeMaxSize :: Int
45handshakeMaxSize = 1 + 256 + 8 + 20 + 20
46
42-- | Default protocol string "BitTorrent protocol" as is. 47-- | Default protocol string "BitTorrent protocol" as is.
43defaultProtocol :: ByteString 48defaultProtocol :: ByteString
44defaultProtocol = "BitTorrent protocol" 49defaultProtocol = "BitTorrent protocol"
@@ -49,4 +54,4 @@ defaultReserved = 0
49 54
50-- | Length of info hash and peer id is unchecked, so it /should/ be equal 20. 55-- | Length of info hash and peer id is unchecked, so it /should/ be equal 20.
51defaultHandshake :: InfoHash -> PeerID -> Handshake 56defaultHandshake :: InfoHash -> PeerID -> Handshake
52defaultHandshake hash pid = Handshake defaultProtocol defaultReserved hash pid \ No newline at end of file 57defaultHandshake = Handshake defaultProtocol defaultReserved \ No newline at end of file