aboutsummaryrefslogtreecommitdiff
path: root/hsm-core/Hsm/Core/Zmq/Server.hs
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-01-28 21:59:21 +0000
committerPaul Oliver <contact@pauloliver.dev>2025-01-29 04:13:02 +0000
commit194800033037f25f4c9fdae365f63f6abe0e110c (patch)
treef92ffe59b3850c6c2325d8a2c2637ff87c5ac40f /hsm-core/Hsm/Core/Zmq/Server.hs
parent9d2f95bb58f856aaf9142426e90e5783c98af8f1 (diff)
Adds logging domain to ZMQ resource operations
Diffstat (limited to 'hsm-core/Hsm/Core/Zmq/Server.hs')
-rw-r--r--hsm-core/Hsm/Core/Zmq/Server.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/hsm-core/Hsm/Core/Zmq/Server.hs b/hsm-core/Hsm/Core/Zmq/Server.hs
index 6ea8aeb..fd2f159 100644
--- a/hsm-core/Hsm/Core/Zmq/Server.hs
+++ b/hsm-core/Hsm/Core/Zmq/Server.hs
@@ -54,12 +54,14 @@ runServer ::
)
=> Eff (Server : es) a
-> Eff es a
-runServer action =
- withSocket Z.Pub >>= \sock ->
- E.evalStaticRep (Server sock) $ do
- localDomain domain $ do
- logInfo_ "Initializing ZMQ server"
- env <- ask @env
- E.unsafeEff_ $ Z.bind sock $ unpack env.pubEp
- logTrace_ $ "Publishing to " <> env.pubEp
- action
+runServer action = do
+ sock <- localDomain domain $ withSocket Z.Pub
+ E.evalStaticRep (Server sock) $ do
+ localDomain domain $ initialize sock
+ action
+ where
+ initialize sock = do
+ logInfo_ "Initializing ZMQ server"
+ env <- ask @env
+ E.unsafeEff_ $ Z.bind sock $ unpack env.pubEp
+ logTrace_ $ "Publishing to " <> env.pubEp