X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FMain.hs;h=6dfbfb7ec54220414c727e748774261b95ab9d55;hp=0a2f7d7473482d624935cccc931600c39494aa4c;hb=dced73db0b1ad1b8cf892041f9921347ab6e992e;hpb=93702736986b10815324647bb002ab2c269afec0 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