From 2c8ef85980a5820b87f47d2e99aa511beb1eb9af Mon Sep 17 00:00:00 2001 From: voidlizard Date: Fri, 25 Oct 2024 16:53:11 +0300 Subject: [PATCH] fixed-messaging-and-basic-probes --- hbs2-peer/app/RPC2/Probes.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 hbs2-peer/app/RPC2/Probes.hs diff --git a/hbs2-peer/app/RPC2/Probes.hs b/hbs2-peer/app/RPC2/Probes.hs new file mode 100644 index 00000000..859b3d00 --- /dev/null +++ b/hbs2-peer/app/RPC2/Probes.hs @@ -0,0 +1,24 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# LANGUAGE UndecidableInstances #-} +module RPC2.Probes where + +import HBS2.Prelude.Plated +import HBS2.Net.Proto.Service + +import HBS2.System.Logger.Simple + +import HBS2.Peer.RPC.API.Peer +import HBS2.Peer.RPC.Internal.Types + +import UnliftIO + +instance (MonadIO m, HasRpcContext PeerAPI RPC2Context m) => HandleMethod m RpcGetProbes where + + handleMethod _ = do + probes <- getRpcContext @PeerAPI + <&> rpcProbes + >>= readTVarIO + + debug $ "rpc.getProbes" + probeSnapshot probes +