aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Types
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-22 00:27:12 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-22 00:27:12 -0400
commit3eed70c3d2dfec84f739fcfaf591513743b2e2de (patch)
treeb478fdb7a675ab06e9265514503811dfc9fadf94 /Assistant/Types
parentbc386221adc3929567b2a18b396f8d5442841960 (diff)
avoid building up a lot of threads all waiting for their chance to run a push
Only 2 threads are needed, one running, and one waiting to push something new. Any more is redundant and wasteful.
Diffstat (limited to 'Assistant/Types')
-rw-r--r--Assistant/Types/NetMessager.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/Assistant/Types/NetMessager.hs b/Assistant/Types/NetMessager.hs
index cfcbe2aa3..525ff29f2 100644
--- a/Assistant/Types/NetMessager.hs
+++ b/Assistant/Types/NetMessager.hs
@@ -133,6 +133,9 @@ data NetMessager = NetMessager
-- only one side of a push can be running at a time
-- the TMVars are empty when nothing is running
, netMessagerPushRunning :: SideMap (TMVar ClientID)
+ -- number of threads trying to push to the same client
+ -- at the same time (either running, or waiting to run)
+ , netMessagerPushThreadCount :: SideMap (TVar (M.Map ClientID Int))
-- incoming messages containing data for a push,
-- on a per-client and per-side basis
, netMessagesInboxes :: SideMap Inboxes
@@ -146,3 +149,4 @@ newNetMessager = NetMessager
<*> newEmptySV
<*> mkSideMap newEmptyTMVar
<*> mkSideMap (newTVar M.empty)
+ <*> mkSideMap (newTVar M.empty)