Skip to content

Commit a250c6c

Browse files
committed
Update ouroboros-network-framework usage
1 parent 36872f6 commit a250c6c

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

lib/byron/src/Cardano/Wallet/Byron.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ import Network.Wai.Handler.Warp
130130
( setBeforeMainLoop )
131131
import Network.Wai.Middleware.Logging
132132
( ApiLog )
133+
import Ouroboros.Network.CodecCBORTerm
134+
( CodecCBORTerm )
133135
import Ouroboros.Network.NodeToClient
134136
( NodeToClientVersionData (..) )
135-
import Ouroboros.Network.Protocol.Handshake.Version
136-
( CodecCBORTerm )
137137
import System.Exit
138138
( ExitCode (..) )
139139
import System.IOManager

lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ import Ouroboros.Network.Block
108108
)
109109
import Ouroboros.Network.ChainFragment
110110
( HasHeader (..) )
111+
import Ouroboros.Network.CodecCBORTerm
112+
( CodecCBORTerm )
111113
import Ouroboros.Network.Magic
112114
( NetworkMagic (..) )
113115
import Ouroboros.Network.NodeToClient
114116
( NodeToClientVersionData (..), nodeToClientCodecCBORTerm )
115117
import Ouroboros.Network.Point
116118
( WithOrigin (..) )
117-
import Ouroboros.Network.Protocol.Handshake.Version
118-
( CodecCBORTerm )
119119

120120
import qualified Cardano.Crypto.Hashing as CC
121121
import qualified Cardano.Wallet.Primitive.Types as W

lib/byron/src/Cardano/Wallet/Byron/Network.hs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import Control.Concurrent.Async
6262
import Control.Exception
6363
( IOException )
6464
import Control.Monad
65-
( (>=>) )
65+
( forever, (>=>) )
6666
import Control.Monad.Catch
6767
( Handler (..) )
6868
import Control.Monad.Class.MonadAsync
@@ -159,6 +159,8 @@ import Ouroboros.Network.Channel
159159
( Channel )
160160
import Ouroboros.Network.Codec
161161
( DeserialiseFailure )
162+
import Ouroboros.Network.CodecCBORTerm
163+
( CodecCBORTerm )
162164
import Ouroboros.Network.Driver.Simple
163165
( TraceSendRecv, runPeer )
164166
import Ouroboros.Network.Mux
@@ -190,7 +192,7 @@ import Ouroboros.Network.Protocol.ChainSync.Codec
190192
import Ouroboros.Network.Protocol.ChainSync.Type
191193
( ChainSync )
192194
import Ouroboros.Network.Protocol.Handshake.Version
193-
( CodecCBORTerm, DictVersion (..), simpleSingletonVersions )
195+
( DictVersion (..), simpleSingletonVersions )
194196
import Ouroboros.Network.Protocol.LocalTxSubmission.Client
195197
( LocalTxClientStIdle (..)
196198
, LocalTxSubmissionClient (..)
@@ -425,7 +427,17 @@ mkNetworkClient tr bp chainSyncQ localTxSubmissionQ =
425427
let tr' = contramap MsgTxSubmission tr in
426428
InitiatorProtocolOnly $ MuxPeerRaw $ \channel ->
427429
localTxSubmission tr' localTxSubmissionQ channel
430+
, localStateQueryProtocol =
431+
doNothingProtocol
428432
}
433+
NodeToClientV_2
434+
435+
-- | A protocol client that will never leave the initial state.
436+
doNothingProtocol
437+
:: MonadTimer m => RunMiniProtocol 'InitiatorApp ByteString m a Void
438+
doNothingProtocol =
439+
InitiatorProtocolOnly $ MuxPeerRaw $
440+
const $ forever $ threadDelay 1e6
429441

430442
-- Connect a client to a network, see `mkNetworkClient` to construct a network
431443
-- client interface.
@@ -440,7 +452,7 @@ connectClient
440452
-> IO ()
441453
connectClient tr handlers client (vData, vCodec) addr = withIOManager $ \iocp -> do
442454
let vDict = DictVersion vCodec
443-
let versions = simpleSingletonVersions NodeToClientV_1 vData vDict client
455+
let versions = simpleSingletonVersions NodeToClientV_2 vData vDict client
444456
let tracers = NetworkConnectTracers
445457
{ nctMuxTracer = nullTracer
446458
, nctHandshakeTracer = contramap MsgHandshakeTracer tr
@@ -511,6 +523,7 @@ handleMuxError tr onResourceVanished = pure . errorType >=> \case
511523
MuxIngressQueueOverRun -> pure False
512524
MuxInitiatorOnly -> pure False
513525
MuxSDUReadTimeout -> pure False
526+
MuxSDUWriteTimeout -> pure False
514527
MuxIOException e ->
515528
handleIOException tr onResourceVanished e
516529
MuxBearerClosed -> do

0 commit comments

Comments
 (0)