diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-08-27 18:33:16 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-08-30 20:53:55 +0200 |
commit | c27b3c23ecdd53acdbfece747b9bbdb39bf4dae9 (patch) | |
tree | 52a4be70840e2691195ec54149f5ac14ec112606 /src/Network.hs | |
parent | dfddb65ad1abf5ba4171be42d303850ebbc363ee (diff) |
Replace storedStorage usage with MonadHead
Diffstat (limited to 'src/Network.hs')
-rw-r--r-- | src/Network.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Network.hs b/src/Network.hs index 3614de0..96f8527 100644 --- a/src/Network.hs +++ b/src/Network.hs @@ -22,6 +22,7 @@ import Control.Concurrent.STM import Control.Exception import Control.Monad import Control.Monad.Except +import Control.Monad.Reader import Control.Monad.State import qualified Data.ByteString.Char8 as BC @@ -527,7 +528,7 @@ withPeerIdentity peer act = liftIO $ atomically $ readTVar (peerIdentityVar peer setupChannel :: UnifiedIdentity -> Peer -> UnifiedIdentity -> WaitingRefCallback setupChannel identity peer upid = do - req <- createChannelRequest (peerStorage peer) identity upid + req <- flip runReaderT (peerStorage peer) $ createChannelRequest identity upid let reqref = refDigest $ storedRef req let hitems = [ TrChannelRequest reqref @@ -544,7 +545,7 @@ setupChannel identity peer upid = do handleChannelRequest :: Peer -> UnifiedIdentity -> Ref -> WaitingRefCallback handleChannelRequest peer identity req = do withPeerIdentity peer $ \upid -> do - (acc, ch) <- acceptChannelRequest identity upid (wrappedLoad req) + (acc, ch) <- flip runReaderT (peerStorage peer) $ acceptChannelRequest identity upid (wrappedLoad req) liftIO $ atomically $ do getPeerChannel peer >>= \case ChannelPeerRequest wr | wrDigest wr == refDigest req -> do |