summaryrefslogtreecommitdiff
path: root/Assistant/NetMessager.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/NetMessager.hs')
-rw-r--r--Assistant/NetMessager.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/Assistant/NetMessager.hs b/Assistant/NetMessager.hs
index ab1c6aabe..5a2746cc7 100644
--- a/Assistant/NetMessager.hs
+++ b/Assistant/NetMessager.hs
@@ -74,17 +74,19 @@ queueNetPushMessage m = do
running <- readTMVar (netMessagerPushRunning nm)
case running of
NoPushRunning -> return False
- SendPushRunning cid -> go nm cid
- ReceivePushRunning cid -> go nm cid
+ SendPushRunning runningcid -> do
+ go nm m runningcid
+ return True
+ ReceivePushRunning runningcid -> do
+ go nm m runningcid
+ return True
where
- go nm cid
- | getClientID m == Just cid = do
- writeTChan (netMessagesPush nm) m
- return True
- | otherwise = do
- when (isPushInitiationMessage m) $
- defer nm
- return True
+ go nm (Pushing cid stage) runningcid
+ | cid == runningcid = writeTChan (netMessagesPush nm) m
+ | isPushInitiation stage = defer nm
+ | otherwise = noop
+ go _ _ _ = noop
+
defer nm = do
s <- takeTMVar (netMessagesDeferredPush nm)
putTMVar (netMessagesDeferredPush nm) $ S.insert m s