summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-12-12 18:27:45 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:27 -0500
commiteca9d293170f2c12528f93c4929e73f8eff61f6f (patch)
treeebcc5b5faaf6fdf1b86422a9e623dd221ff3c177 /src/Network
parent3b467bd5c287a6e99bf9a76c0bd06274b560a315 (diff)
Run tcp-send in forked threads and ignore exceptions.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/QueryResponse/TCP.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Network/QueryResponse/TCP.hs b/src/Network/QueryResponse/TCP.hs
index 154e9145..328a19e1 100644
--- a/src/Network/QueryResponse/TCP.hs
+++ b/src/Network/QueryResponse/TCP.hs
@@ -98,7 +98,7 @@ acquireConnection mvar tcpcache stream addr = do
98 killThread (tcpThread r) 98 killThread (tcpThread r)
99 streamGoodbye st 99 streamGoodbye st
100 hClose (tcpHandle r) 100 hClose (tcpHandle r)
101 atomically $ writeTVar (lru tcpcache) cache' 101 atomically $ modifyTVar' (lru tcpcache) $ MM.delete (TCPAddress k)
102 102
103 return $ Just $ streamEncode st 103 return $ Just $ streamEncode st
104 Just (tm,v) -> do 104 Just (tm,v) -> do
@@ -126,7 +126,10 @@ tcpTransport maxcon stream = do
126 return Transport 126 return Transport
127 { awaitMessage = (takeMVar msgvar >>=) 127 { awaitMessage = (takeMVar msgvar >>=)
128 , sendMessage = \addr y -> do 128 , sendMessage = \addr y -> do
129 msock <- acquireConnection msgvar tcpcache stream addr 129 t <- forkIO $ do
130 mapM_ ($ y) msock 130 msock <- acquireConnection msgvar tcpcache stream addr
131 mapM_ ($ y) msock
132 `catchIOError` \e -> return ()
133 labelThread t "tcp-send"
131 , closeTransport = closeAll tcpcache stream 134 , closeTransport = closeAll tcpcache stream
132 } 135 }