summaryrefslogtreecommitdiff
path: root/src/Network/KRPC
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-08 06:56:28 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-08 06:56:28 +0400
commit1fb619d9d5edc1c352e2b72cbf5dfcf5c64d05ff (patch)
tree37ccd6b5a301eda46086e1ac9166aa7596f4c731 /src/Network/KRPC
parente26ef0001157a1ff6b3a1ec809e5c53c37472161 (diff)
Allow to ask for query count
Diffstat (limited to 'src/Network/KRPC')
-rw-r--r--src/Network/KRPC/Manager.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Network/KRPC/Manager.hs b/src/Network/KRPC/Manager.hs
index 468744c1..e2b60b6a 100644
--- a/src/Network/KRPC/Manager.hs
+++ b/src/Network/KRPC/Manager.hs
@@ -29,6 +29,7 @@ module Network.KRPC.Manager
29 -- * Queries 29 -- * Queries
30 , QueryFailure (..) 30 , QueryFailure (..)
31 , query 31 , query
32 , getQueryCount
32 33
33 -- * Handlers 34 -- * Handlers
34 , HandlerFailure (..) 35 , HandlerFailure (..)
@@ -232,6 +233,13 @@ genTransactionId ref = do
232 cur <- atomicModifyIORef' ref $ \ cur -> (succ cur, cur) 233 cur <- atomicModifyIORef' ref $ \ cur -> (succ cur, cur)
233 return $ BC.pack (show cur) 234 return $ BC.pack (show cur)
234 235
236-- | How many times 'query' call have been performed.
237getQueryCount :: MonadKRPC h m => m Int
238getQueryCount = do
239 Manager {..} <- getManager
240 curTrans <- liftIO $ readIORef transactionCounter
241 return $ curTrans - optSeedTransaction options
242
235registerQuery :: CallId -> PendingCalls -> IO CallRes 243registerQuery :: CallId -> PendingCalls -> IO CallRes
236registerQuery cid ref = do 244registerQuery cid ref = do
237 ares <- newEmptyMVar 245 ares <- newEmptyMVar