summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange/Protocol.hs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-12 07:34:34 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-12 07:34:34 +0400
commit5c3c114e0e84339f88892e08010bd8b1408431d1 (patch)
tree70763a0fa0fc3c9f7ecbf1242b479a55b07cf1e2 /src/Network/BitTorrent/Exchange/Protocol.hs
parent8b005c4eb0f58db974c342efe0821240f39a6331 (diff)
~ Minor fixes.
* Annotate all required fields as strict. These are always used and there is no reason to keep them lazy. * Augment user errors with location.
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Protocol.hs')
-rw-r--r--src/Network/BitTorrent/Exchange/Protocol.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/Exchange/Protocol.hs b/src/Network/BitTorrent/Exchange/Protocol.hs
index 6b97d8d1..d2d3da6c 100644
--- a/src/Network/BitTorrent/Exchange/Protocol.hs
+++ b/src/Network/BitTorrent/Exchange/Protocol.hs
@@ -181,7 +181,7 @@ handshake sock hs = do
181 181
182 case checkIH (S.decode resp) of 182 case checkIH (S.decode resp) of
183 Right hs' -> return hs' 183 Right hs' -> return hs'
184 Left msg -> throw $ userError msg 184 Left msg -> throwIO $ userError $ msg ++ " in handshake body."
185 where 185 where
186 checkIH (Right hs') 186 checkIH (Right hs')
187 | hsInfoHash hs /= hsInfoHash hs' 187 | hsInfoHash hs /= hsInfoHash hs'
@@ -234,10 +234,10 @@ ppBlockIx BlockIx {..} =
234 234
235data Block = Block { 235data Block = Block {
236 -- | Zero-based piece index. 236 -- | Zero-based piece index.
237 blkPiece :: !PieceLIx 237 blkPiece :: {-# UNPACK #-} !PieceLIx
238 238
239 -- | Zero-based byte offset within the piece. 239 -- | Zero-based byte offset within the piece.
240 , blkOffset :: !Int 240 , blkOffset :: {-# UNPACK #-} !Int
241 241
242 -- | Payload. 242 -- | Payload.
243 , blkData :: !ByteString 243 , blkData :: !ByteString