summaryrefslogtreecommitdiff
path: root/src/Network/KRPC
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-07 04:18:50 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-07 04:18:50 +0400
commit018afe46b911c14472cf1a8cf315912e5c687e04 (patch)
treef710f24336825dd7d44b29851634105d4fbd6092 /src/Network/KRPC
parent6e77e14e2c011760eccc9d6989cd229420bdc741 (diff)
Fix listenerThread mvar state tracking
Diffstat (limited to 'src/Network/KRPC')
-rw-r--r--src/Network/KRPC/Manager.hs7
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
35import Control.Concurrent 35import Control.Concurrent
36import Control.Concurrent.Lifted (fork) 36import Control.Concurrent.Lifted (fork)
37import Control.Exception hiding (Handler) 37import Control.Exception hiding (Handler)
38import Control.Exception.Lifted as Lifted (catch) 38import Control.Exception.Lifted as Lifted (catch, finally)
39import Control.Monad 39import Control.Monad
40import Control.Monad.Logger 40import Control.Monad.Logger
41import Control.Monad.Reader 41import Control.Monad.Reader
@@ -332,6 +332,7 @@ handleMessage (Q q) = handleQuery q
332handleMessage (R r) = handleResponse (Right r) 332handleMessage (R r) = handleResponse (Right r)
333handleMessage (E e) = handleResponse (Left e) 333handleMessage (E e) = handleResponse (Left e)
334 334
335-- TODO to options
335maxMsgSize :: Int 336maxMsgSize :: Int
336maxMsgSize = 64 * 1024 337maxMsgSize = 64 * 1024
337 338
@@ -356,5 +357,7 @@ listener = do
356listen :: MonadKRPC h m => m () 357listen :: MonadKRPC h m => m ()
357listen = do 358listen = 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