diff --git a/src/Network/WebSockets/Server.hs b/src/Network/WebSockets/Server.hs index 81a8bad..7d96b85 100644 --- a/src/Network/WebSockets/Server.hs +++ b/src/Network/WebSockets/Server.hs @@ -111,7 +111,7 @@ runServerWithOptions opts app = S.withSocketsDo $ bracket (makeListenSocket (serverHost opts) (serverPort opts)) S.close $ \sock -> do - heartbeat <- newEmptyMVar :: IO (MVar ()) + heartbeat <- newEmptyMVar let -- Update the connection options to perform a heartbeat whenever a -- pong is received. @@ -120,7 +120,7 @@ runServerWithOptions opts app = S.withSocketsDo $ } -- Kills the thread if pong was not received within the grace period. - reaper grace appAsync = timeout (grace * 10^(6 :: Int)) (takeMVar heartbeat) >>= \case + reaper grace appAsync = timeout (grace * 1_000_000) (takeMVar heartbeat) >>= \case Nothing -> appAsync `Async.cancelWith` PongTimeout Just _ -> reaper grace appAsync