-- If we haven't received anything in fifteen minutes, return back
-- to the calling function. This should only happen in the case of
-- an error, and our caller should be prepared to handle it.
- Nothing -> do
- report_warning $ "No data received for 15 minutes."
+ Nothing -> report_warning "No data received for 15 minutes."
+
Just line -> do
-- If the recv didn't timeout, proceed normally.
let new_buffer = line : buffer
connect_and_parse :: Configuration
-> String -- ^ Hostname to connect to
-> IO ()
-connect_and_parse cfg host = do
+connect_and_parse cfg host =
bracket acquire_handle release_handle action
where
five_seconds :: Int
report_info $ "Connecting to " ++ host ++ "."
connectTo host (PortNumber 4500)
- release_handle = \h -> do
+ release_handle h = do
report_info $ "Closing connection to " ++ host ++ "."
hClose h