diff options
-rw-r--r-- | src/Network/KRPC/Manager.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Network/KRPC/Manager.hs b/src/Network/KRPC/Manager.hs index 7edcf72d..d561d7b1 100644 --- a/src/Network/KRPC/Manager.hs +++ b/src/Network/KRPC/Manager.hs | |||
@@ -35,7 +35,7 @@ import Control.Applicative | |||
35 | import Control.Concurrent | 35 | import Control.Concurrent |
36 | import Control.Concurrent.Lifted (fork) | 36 | import Control.Concurrent.Lifted (fork) |
37 | import Control.Exception hiding (Handler) | 37 | import Control.Exception hiding (Handler) |
38 | import Control.Exception.Lifted as Lifted (catch) | 38 | import Control.Exception.Lifted as Lifted (catch, finally) |
39 | import Control.Monad | 39 | import Control.Monad |
40 | import Control.Monad.Logger | 40 | import Control.Monad.Logger |
41 | import Control.Monad.Reader | 41 | import Control.Monad.Reader |
@@ -332,6 +332,7 @@ handleMessage (Q q) = handleQuery q | |||
332 | handleMessage (R r) = handleResponse (Right r) | 332 | handleMessage (R r) = handleResponse (Right r) |
333 | handleMessage (E e) = handleResponse (Left e) | 333 | handleMessage (E e) = handleResponse (Left e) |
334 | 334 | ||
335 | -- TODO to options | ||
335 | maxMsgSize :: Int | 336 | maxMsgSize :: Int |
336 | maxMsgSize = 64 * 1024 | 337 | maxMsgSize = 64 * 1024 |
337 | 338 | ||
@@ -356,5 +357,7 @@ listener = do | |||
356 | listen :: MonadKRPC h m => m () | 357 | listen :: MonadKRPC h m => m () |
357 | listen = do | 358 | listen = do |
358 | Manager {..} <- getManager | 359 | Manager {..} <- getManager |
359 | tid <- fork $ listener | 360 | tid <- fork $ do |
361 | listener `Lifted.finally` | ||
362 | liftIO (takeMVar listenerThread) | ||
360 | liftIO $ putMVar listenerThread tid | 363 | liftIO $ putMVar listenerThread tid |