summaryrefslogtreecommitdiff
path: root/src/System/Torrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-06 22:28:21 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-06 22:28:21 +0400
commit6f3d7093d6e1c2e3c5138da58b850778759435f8 (patch)
tree7e636aa82fba6924a052e326dca8dd88d2209b81 /src/System/Torrent
parente36b714d8eb0444459ea7051feb7b1c9af4154df (diff)
Check piece size in the open function
Diffstat (limited to 'src/System/Torrent')
-rw-r--r--src/System/Torrent/Storage.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/System/Torrent/Storage.hs b/src/System/Torrent/Storage.hs
index 6dda07e1..5315d9dc 100644
--- a/src/System/Torrent/Storage.hs
+++ b/src/System/Torrent/Storage.hs
@@ -90,7 +90,9 @@ data Storage = Storage
90-- * when seeding, validation 'ReadOnly' mode. 90-- * when seeding, validation 'ReadOnly' mode.
91-- 91--
92open :: Mode -> PieceSize -> FileLayout FileSize -> IO Storage 92open :: Mode -> PieceSize -> FileLayout FileSize -> IO Storage
93open mode s l = Storage mode s <$> mmapFiles mode l 93open mode s l
94 | s <= 0 = throwIO (InvalidSize s)
95 | otherwise = Storage mode s <$> mmapFiles mode l
94 96
95-- | Unmaps all files forcefully. It is recommended but not required. 97-- | Unmaps all files forcefully. It is recommended but not required.
96close :: Storage -> IO () 98close :: Storage -> IO ()