diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/QueryResponse/TCP.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Network/QueryResponse/TCP.hs b/src/Network/QueryResponse/TCP.hs index c0bdcd3c..154e9145 100644 --- a/src/Network/QueryResponse/TCP.hs +++ b/src/Network/QueryResponse/TCP.hs | |||
@@ -67,9 +67,12 @@ acquireConnection mvar tcpcache stream addr = do | |||
67 | case MM.lookup' (TCPAddress $ streamAddr stream addr) cache of | 67 | case MM.lookup' (TCPAddress $ streamAddr stream addr) cache of |
68 | Nothing -> do | 68 | Nothing -> do |
69 | proto <- getProtocolNumber "tcp" | 69 | proto <- getProtocolNumber "tcp" |
70 | sock <- socket (socketFamily $ streamAddr stream addr) Stream proto | 70 | mh <- catchIOError (do sock <- socket (socketFamily $ streamAddr stream addr) Stream proto |
71 | connect sock (streamAddr stream addr) `catchIOError` (\e -> close sock) | 71 | connect sock (streamAddr stream addr) `catchIOError` (\e -> close sock) |
72 | h <- socketToHandle sock ReadWriteMode | 72 | h <- socketToHandle sock ReadWriteMode |
73 | return $ Just h) | ||
74 | $ \e -> return Nothing | ||
75 | fmap join $ forM mh $ \h -> do | ||
73 | st <- streamHello stream addr h | 76 | st <- streamHello stream addr h |
74 | t <- getPOSIXTime | 77 | t <- getPOSIXTime |
75 | rthread <- forkIO $ fix $ \loop -> do | 78 | rthread <- forkIO $ fix $ \loop -> do |