diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-12 16:01:00 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-12 16:01:00 -0400 |
commit | 80fb3d85b2b9a30e8b717dc63aaca75d346f5667 (patch) | |
tree | e505b607fc39f3c4a8f9169619ca2d658fede994 /debug-me.hs | |
parent | be3cf7447253d08bd55a632409c059cd5894a243 (diff) | |
download | debug-me-80fb3d85b2b9a30e8b717dc63aaca75d346f5667.tar.gz |
simulate laggy network
Diffstat (limited to 'debug-me.hs')
-rw-r--r-- | debug-me.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/debug-me.hs b/debug-me.hs index 4122881..a0d7476 100644 --- a/debug-me.hs +++ b/debug-me.hs @@ -6,6 +6,7 @@ import Types import Hash import Pty +import Control.Concurrent import Control.Concurrent.Async import Control.Concurrent.STM import System.IO @@ -34,6 +35,9 @@ main = do cancel uthread return exitstatus +networkDelay :: IO () +networkDelay = threadDelay 1000000 + developer :: TChan (Activity Entered) -> TChan (Activity Seen) -> IO () developer ichan ochan = do startact <- atomically $ readTChan ochan @@ -147,6 +151,7 @@ sendPtyInput ichan p backlog = go where Master h = ptyMaster p go = do + networkDelay mb <- atomically $ do newact <- readTChan ichan bl <- readTVar backlog |