From: Michael Orlitzky Date: Mon, 27 Jan 2014 20:22:09 +0000 (-0500) Subject: Minor cleanups in Main. X-Git-Tag: 0.0.6^0 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=dced73db0b1ad1b8cf892041f9921347ab6e992e;p=dead%2Fhtsn.git Minor cleanups in Main. --- diff --git a/src/Main.hs b/src/Main.hs index 0a2f7d7..6dfbfb7 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -122,8 +122,8 @@ loop !cfg !h !buffer = do -- 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 @@ -225,7 +225,7 @@ log_in cfg h = do 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 @@ -235,7 +235,7 @@ connect_and_parse cfg host = do 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