summaryrefslogtreecommitdiff
path: root/P2P
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-02 14:16:50 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-02 14:16:50 -0400
commitaf69d6a45bcb29149eccde2b0d675a551233ff71 (patch)
treed38c2a46b18899d61a3075cb3fb5133be7de704e /P2P
parent9d6ee2fe7fa1ec5511070a964ba35d9c9711e235 (diff)
catch non-IO exceptions too
Diffstat (limited to 'P2P')
-rw-r--r--P2P/IO.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/P2P/IO.hs b/P2P/IO.hs
index 6ab6cc278..fb621ab2b 100644
--- a/P2P/IO.hs
+++ b/P2P/IO.hs
@@ -63,14 +63,14 @@ runNetProto runenv = go
runNet :: (MonadIO m, MonadMask m) => RunEnv -> RunProto m -> NetF (Proto a) -> m (Maybe a)
runNet runenv runner f = case f of
SendMessage m next -> do
- v <- liftIO $ tryIO $ do
+ v <- liftIO $ tryNonAsync $ do
hPutStrLn (runOhdl runenv) (unwords (formatMessage m))
hFlush (runOhdl runenv)
case v of
Left _e -> return Nothing
Right () -> runner next
ReceiveMessage next -> do
- v <- liftIO $ tryIO $ hGetLine (runIhdl runenv)
+ v <- liftIO $ tryNonAsync $ hGetLine (runIhdl runenv)
case v of
Left _e -> return Nothing
Right l -> case parseMessage l of
@@ -80,7 +80,7 @@ runNet runenv runner f = case f of
net $ sendMessage e
next e
SendBytes len b next -> do
- v <- liftIO $ tryIO $ do
+ v <- liftIO $ tryNonAsync $ do
ok <- sendExactly len b (runOhdl runenv)
hFlush (runOhdl runenv)
return ok
@@ -88,7 +88,7 @@ runNet runenv runner f = case f of
Right True -> runner next
_ -> return Nothing
ReceiveBytes (Len n) next -> do
- v <- liftIO $ tryIO $ L.hGet (runIhdl runenv) (fromIntegral n)
+ v <- liftIO $ tryNonAsync $ L.hGet (runIhdl runenv) (fromIntegral n)
case v of
Left _e -> return Nothing
Right b -> runner (next b)