@@ -35,6 +35,7 @@ import qualified Data.Set as Set
3535import LeiosProtocol.Relay
3636import LeiosProtocol.RelayBuffer (RelayBuffer )
3737import qualified LeiosProtocol.RelayBuffer as RB
38+ import P2P
3839import STMCompat
3940import SimTCPLinks (labelDirToLabelLink , selectTimedEvents , simTracer )
4041import SimTypes
@@ -54,7 +55,7 @@ data RelaySimEvent
5455 RelaySimEventSetup
5556 ! World
5657 ! (Map NodeId Point ) -- nodes and locations
57- ! (Set ( NodeId , NodeId ) ) -- links between nodes
58+ ! (Set Link ) -- links between nodes
5859 | -- | An event at a node
5960 RelaySimEventNode (LabelNode (RelayNodeEvent TestBlock ))
6061 | -- | An event on a tcp link between two nodes
@@ -248,8 +249,8 @@ relayNode
248249testHeader :: TestBlock -> TestBlockHeader
249250testHeader blk = TestBlockHeader (testBlockId blk) (testBlockExpiry blk)
250251
251- symmetric :: Ord a => Set (a , a ) -> Set (a , a )
252- symmetric xys = xys <> Set. map (\ (x, y) -> (y, x)) xys
252+ symmetric :: Ord a => Set (Link' a ) -> Set (Link' a )
253+ symmetric xys = xys <> Set. map (\ (x :<- y) -> (y :<- x)) xys
253254
254255newtype TestRelayBundle f = TestRelayBundle
255256 { testMsg :: f TestBlockRelayMessage
@@ -287,7 +288,7 @@ traceRelayLink1 tcpprops generationPattern =
287288 ]
288289 )
289290 ( Set. fromList
290- [(NodeId 0 , NodeId 1 ), (NodeId 1 , NodeId 0 )]
291+ [(NodeId 0 :<- NodeId 1 ), (NodeId 1 :<- NodeId 0 )]
291292 )
292293 (inChan, outChan) <- newConnectionTCP (linkTracer na nb) tcpprops
293294 concurrently_
@@ -335,7 +336,7 @@ traceRelayLink4 tcpprops generationPattern =
335336 ]
336337 )
337338 ( symmetric $
338- Set. fromList
339+ Set. fromList . map ( uncurry (:<-) ) $
339340 [ (NodeId 0 , NodeId 1 )
340341 , (NodeId 1 , NodeId 3 )
341342 , (NodeId 0 , NodeId 2 )
@@ -397,7 +398,7 @@ traceRelayLink4Asymmetric tcppropsShort tcppropsLong generationPattern =
397398 ]
398399 )
399400 ( symmetric $
400- Set. fromList
401+ Set. fromList . map ( uncurry (:<-) ) $
401402 [ (NodeId 0 , NodeId 1 )
402403 , (NodeId 1 , NodeId 3 )
403404 , (NodeId 0 , NodeId 2 )
0 commit comments