Skip to content

Commit

Permalink
Style 2
Browse files Browse the repository at this point in the history
  • Loading branch information
intricate committed Apr 7, 2020
1 parent 0f4acd3 commit 05436f9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ directPipelined (TxSubmissionServerPipelined mserver)
directSender q (SendMsgRequestTxsPipelined txids serverNext)
ClientStIdle{recvMsgRequestTxs} = do
server' <- serverNext
SendMsgReplyTxs txs onTxsSent client' <- recvMsgRequestTxs txids
_ <- onTxsSent txs
SendMsgReplyTxs txs mClient' <- recvMsgRequestTxs txids
client' <- mClient'
directSender (enqueue (CollectTxs txids txs) q) server' client'

directSender q (CollectPipelined (Just server') _) client =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ txSubmissionClient tracer txId txSize maxUnacked =
traceWith tracer (EventRecvMsgRequestTxs unackedSeq unackedMap
remainingTxs txids)
case [ txid | txid <- txids, txid `Map.notMember` unackedMap ] of
[] -> pure (SendMsgReplyTxs txs (const $ pure ()) client')
[] -> pure (SendMsgReplyTxs txs (pure client'))
where
txs = map (unackedMap Map.!) txids
client' = client unackedSeq unackedMap' remainingTxs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ data ClientStTxIds blocking txid tx m a where

data ClientStTxs txid tx m a where
SendMsgReplyTxs :: [tx]
-> ([tx] -> m ())
-> ClientStIdle txid tx m a
-> m (ClientStIdle txid tx m a)
-> ClientStTxs txid tx m a


Expand Down Expand Up @@ -111,7 +110,7 @@ txSubmissionClientPeer (TxSubmissionClient client) =
(Done TokDone result)

MsgRequestTxs txids -> Effect $ do
SendMsgReplyTxs txs onTxsSent k <- recvMsgRequestTxs txids
SendMsgReplyTxs txs k <- recvMsgRequestTxs txids
return $ Yield (ClientAgency TokTxs)
(MsgReplyTxs txs)
(Effect $ onTxsSent txs >> return (go k))
(Effect $ k >>= return . go)
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,6 @@ txSubmissionOutbound tracer maxUnacked TxSubmissionMempoolReader{..} =
client' = client unackedSeq unackedMap' lastIdx

-- Trace the transactions to be sent in the response.
traceTxsSent = traceWith tracer . TraceTxSubmissionOutboundSendMsgReplyTxs
traceTxsSent = traceWith tracer (TraceTxSubmissionOutboundSendMsgReplyTxs txs)

return $ SendMsgReplyTxs txs traceTxsSent client'
return $ SendMsgReplyTxs txs (traceTxsSent >> pure client')

0 comments on commit 05436f9

Please sign in to comment.