summaryrefslogtreecommitdiff
path: root/dht
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-10-18 05:13:20 -0400
committerJoe Crayne <joe@jerkface.net>2020-01-01 19:51:05 -0500
commit88cb351cb6ddfb5e80f247bea6cc503ed1e12baf (patch)
tree0d695363e30804febcae4f9d130296ecbbb7a30a /dht
parentb3795514a956753b1b58a3709ce08e32d906b742 (diff)
Clean up forked transports.
Diffstat (limited to 'dht')
-rw-r--r--dht/src/Network/QueryResponse.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/dht/src/Network/QueryResponse.hs b/dht/src/Network/QueryResponse.hs
index 4f956936..c7ab59d8 100644
--- a/dht/src/Network/QueryResponse.hs
+++ b/dht/src/Network/QueryResponse.hs
@@ -124,15 +124,15 @@ partitionTransportM parse encodex tr = do
124 awaitMessage tr $ \m -> case m of 124 awaitMessage tr $ \m -> case m of
125 Just (Right msg) -> parse msg >>= 125 Just (Right msg) -> parse msg >>=
126 either (kont . Just . Right) 126 either (kont . Just . Right)
127 (\y -> putMVar mvar y >> again) 127 (\y -> putMVar mvar (Just y) >> again)
128 Just (Left e) -> kont $ Just (Left e) 128 Just (Left e) -> kont $ Just (Left e)
129 Nothing -> kont Nothing 129 Nothing -> putMVar mvar Nothing >> kont Nothing
130 , sendMessage = \addr' msg' -> do 130 , sendMessage = \addr' msg' -> do
131 msg_addr <- encodex (msg',addr') 131 msg_addr <- encodex (msg',addr')
132 mapM_ (uncurry . flip $ sendMessage tr) msg_addr 132 mapM_ (uncurry . flip $ sendMessage tr) msg_addr
133 } 133 }
134 ytr = Transport 134 ytr = Transport
135 { awaitMessage = \kont -> takeMVar mvar >>= kont . Just . Right 135 { awaitMessage = \kont -> takeMVar mvar >>= kont . fmap Right
136 , sendMessage = sendMessage tr 136 , sendMessage = sendMessage tr
137 , closeTransport = return () 137 , closeTransport = return ()
138 } 138 }
@@ -150,9 +150,9 @@ partitionAndForkTransport forkedSend parse encodex tr = do
150 awaitMessage tr $ \m -> case m of 150 awaitMessage tr $ \m -> case m of
151 Just (Right msg) -> parse msg >>= 151 Just (Right msg) -> parse msg >>=
152 either (kont . Just . Right) 152 either (kont . Just . Right)
153 (\y -> putMVar mvar y >> again) 153 (\y -> putMVar mvar (Just y) >> again)
154 Just (Left e) -> kont $ Just (Left e) 154 Just (Left e) -> kont $ Just (Left e)
155 Nothing -> kont Nothing 155 Nothing -> putMVar mvar Nothing >> kont Nothing
156 , sendMessage = \addr' msg' -> do 156 , sendMessage = \addr' msg' -> do
157 msg_addr <- encodex (msg',addr') 157 msg_addr <- encodex (msg',addr')
158 case msg_addr of 158 case msg_addr of
@@ -161,7 +161,7 @@ partitionAndForkTransport forkedSend parse encodex tr = do
161 Nothing -> return () 161 Nothing -> return ()
162 } 162 }
163 ytr = Transport 163 ytr = Transport
164 { awaitMessage = \kont -> takeMVar mvar >>= kont . Just . Right 164 { awaitMessage = \kont -> takeMVar mvar >>= kont . fmap Right
165 , sendMessage = sendMessage tr 165 , sendMessage = sendMessage tr
166 , closeTransport = return () 166 , closeTransport = return ()
167 } 167 }