From 191a863e0cea911a8f44f25a67b31363461db42a Mon Sep 17 00:00:00 2001 From: Sam T Date: Tue, 9 Apr 2013 00:06:08 +0400 Subject: + handshake message max size --- src/Network/Torrent/PeerWire/Handshake.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Network/Torrent/PeerWire') 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 @@ {-# LANGUAGE OverloadedStrings #-} module Network.Torrent.PeerWire.Handshake ( Handshake + , handshakeMaxSize , defaultProtocol, defaultReserved, defaultHandshake ) where @@ -39,6 +40,10 @@ instance Serialize Handshake where <*> get <*> get +-- | Maximum size of handshake message in bytes. +handshakeMaxSize :: Int +handshakeMaxSize = 1 + 256 + 8 + 20 + 20 + -- | Default protocol string "BitTorrent protocol" as is. defaultProtocol :: ByteString defaultProtocol = "BitTorrent protocol" @@ -49,4 +54,4 @@ defaultReserved = 0 -- | Length of info hash and peer id is unchecked, so it /should/ be equal 20. defaultHandshake :: InfoHash -> PeerID -> Handshake -defaultHandshake hash pid = Handshake defaultProtocol defaultReserved hash pid \ No newline at end of file +defaultHandshake = Handshake defaultProtocol defaultReserved \ No newline at end of file -- cgit v1.2.3