aboutsummaryrefslogtreecommitdiff
path: root/src/BTLS/Result.hs
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2018-09-28 18:33:35 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2018-09-28 18:33:35 -0400
commite74149a7569afd1ea7d67c77f40c37471e7e3e58 (patch)
treed8478e569eade926a72829eee9d3afe0e8f12710 /src/BTLS/Result.hs
parent8ac48890e98a4974980b8ca3d5e90a2e52c1a624 (diff)
Begin implementing symmetric encryption
Support RC4. Future commits will add support for more modern algorithms.
Diffstat (limited to 'src/BTLS/Result.hs')
-rw-r--r--src/BTLS/Result.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/BTLS/Result.hs b/src/BTLS/Result.hs
index a3c153c..f75d89e 100644
--- a/src/BTLS/Result.hs
+++ b/src/BTLS/Result.hs
@@ -15,7 +15,7 @@
module BTLS.Result
( alwaysSucceeds, requireSuccess
, Result, Error, file, line, errorData, errorDataIsHumanReadable
- , check
+ , check, check'
) where
import Control.Concurrent (rtsSupportsBoundThreads, runInBoundThread)
@@ -70,10 +70,13 @@ dequeueError = do
return (Just (errorFromTuple e))
check :: IO Int -> ExceptT [Error] IO ()
-check f = do
+check = ExceptT . check'
+
+check' :: IO Int -> IO (Either [Error] ())
+check' f = do
unless rtsSupportsBoundThreads $
error "btls requires the threaded runtime. Please recompile with -threaded."
- ExceptT $ runInBoundThread $ do
+ runInBoundThread $ do
-- TODO(bbaren): Assert that the error queue is clear
r <- f
if r == 1