diff options
author | joe <joe@jerkface.net> | 2014-02-09 23:36:58 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-02-09 23:36:58 -0500 |
commit | e710ed2434496f7891363def81c1c8756eadd129 (patch) | |
tree | ed6022cf97f54af6fd30533062bc96b92e5e40a2 | |
parent | 1b0182eae555aeb2952e40a522bd5215ae0fc6d9 (diff) |
extra careful ping bump
-rw-r--r-- | Presence/Server.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Presence/Server.hs b/Presence/Server.hs index da0cda17..c7162265 100644 --- a/Presence/Server.hs +++ b/Presence/Server.hs | |||
@@ -622,8 +622,13 @@ pingCancel me = do | |||
622 | pingBump :: PingMachine -> IO () | 622 | pingBump :: PingMachine -> IO () |
623 | pingBump me = do | 623 | pingBump me = do |
624 | b <- atomically $ do | 624 | b <- atomically $ do |
625 | when (pingIdle me /= 0) $ | 625 | when (pingIdle me /= 0) $ do |
626 | putTMVar (pingDelay me) (1000*pingIdle me,PingIdle) | 626 | e <- tryReadTMVar (pingDelay me) |
627 | case e of | ||
628 | Just (0,PingTimeOut) -> return () -- canceled/fired | ||
629 | Just _ -> retry | ||
630 | Nothing -> putTMVar (pingDelay me) | ||
631 | (1000*pingIdle me,PingIdle) | ||
627 | readTVar (pingStarted me) | 632 | readTVar (pingStarted me) |
628 | when b $ throwTo (pingThread me) $ ErrorCall "" | 633 | when b $ throwTo (pingThread me) $ ErrorCall "" |
629 | 634 | ||