summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange/Protocol.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Protocol.hs')
-rw-r--r--src/Network/BitTorrent/Exchange/Protocol.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Exchange/Protocol.hs b/src/Network/BitTorrent/Exchange/Protocol.hs
index feccf760..073dad58 100644
--- a/src/Network/BitTorrent/Exchange/Protocol.hs
+++ b/src/Network/BitTorrent/Exchange/Protocol.hs
@@ -116,7 +116,7 @@ data Handshake = Handshake {
116 -- | Peer id of the initiator. This is usually the same peer id 116 -- | Peer id of the initiator. This is usually the same peer id
117 -- that is transmitted in tracker requests. 117 -- that is transmitted in tracker requests.
118 -- 118 --
119 , hsPeerID :: PeerID 119 , hsPeerId :: PeerId
120 120
121 } deriving (Show, Eq) 121 } deriving (Show, Eq)
122 122
@@ -126,7 +126,7 @@ instance Serialize Handshake where
126 S.putByteString (hsProtocol hs) 126 S.putByteString (hsProtocol hs)
127 S.putWord64be (hsReserved hs) 127 S.putWord64be (hsReserved hs)
128 S.put (hsInfoHash hs) 128 S.put (hsInfoHash hs)
129 S.put (hsPeerID hs) 129 S.put (hsPeerId hs)
130 130
131 get = do 131 get = do
132 len <- S.getWord8 132 len <- S.getWord8
@@ -142,7 +142,7 @@ handshakeCaps = hsReserved
142-- | Format handshake in human readable form. 142-- | Format handshake in human readable form.
143ppHandshake :: Handshake -> Doc 143ppHandshake :: Handshake -> Doc
144ppHandshake Handshake {..} = 144ppHandshake Handshake {..} =
145 text (BC.unpack hsProtocol) <+> ppClientInfo (clientInfo hsPeerID) 145 text (BC.unpack hsProtocol) <+> ppClientInfo (clientInfo hsPeerId)
146 146
147-- | Get handshake message size in bytes from the length of protocol 147-- | Get handshake message size in bytes from the length of protocol
148-- string. 148-- string.
@@ -163,7 +163,7 @@ defaultReserved = 0
163 163
164-- | Length of info hash and peer id is unchecked, so it /should/ be 164-- | Length of info hash and peer id is unchecked, so it /should/ be
165-- equal 20. 165-- equal 20.
166defaultHandshake :: InfoHash -> PeerID -> Handshake 166defaultHandshake :: InfoHash -> PeerId -> Handshake
167defaultHandshake = Handshake defaultBTProtocol defaultReserved 167defaultHandshake = Handshake defaultBTProtocol defaultReserved
168 168
169-- | Handshaking with a peer specified by the second argument. 169-- | Handshaking with a peer specified by the second argument.