summaryrefslogtreecommitdiff
path: root/P2P
diff options
context:
space:
mode:
Diffstat (limited to 'P2P')
-rw-r--r--P2P/IO.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/P2P/IO.hs b/P2P/IO.hs
index a2af5946c..2693558c1 100644
--- a/P2P/IO.hs
+++ b/P2P/IO.hs
@@ -102,10 +102,11 @@ runNet conn runner f = case f of
Left e -> return (Left (show e))
Right () -> runner next
ReceiveMessage next -> do
- v <- liftIO $ tryNonAsync $ hGetLine (connIhdl conn)
+ v <- liftIO $ tryNonAsync $ getProtocolLine (connIhdl conn)
case v of
Left e -> return (Left (show e))
- Right l -> case parseMessage l of
+ Right Nothing -> return (Left "protocol error")
+ Right (Just l) -> case parseMessage l of
Just m -> runner (next m)
Nothing -> runner $ do
let e = ERROR $ "protocol parse error: " ++ show l