summaryrefslogtreecommitdiff
path: root/src/Erebos/Network.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Erebos/Network.hs')
-rw-r--r--src/Erebos/Network.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Erebos/Network.hs b/src/Erebos/Network.hs
index 7c6a61e..744c476 100644
--- a/src/Erebos/Network.hs
+++ b/src/Erebos/Network.hs
@@ -433,7 +433,10 @@ openStream = do
conn <- readTVarP peerConnection >>= \case
Right conn -> return conn
_ -> throwError "can't open stream without established connection"
- (hdr, writer, handler) <- liftSTM $ connAddWriteStream conn
+ (hdr, writer, handler) <- liftSTM (connAddWriteStream conn) >>= \case
+ Right res -> return res
+ Left err -> throwError err
+
liftSTM $ writeTQueue (serverIOActions peerServer_) (liftIO $ forkServerThread peerServer_ handler)
addHeader hdr
return writer