@@ -43,13 +43,14 @@ import qualified Test.Util.TestBlock as TB
4343-- | Glue code for using just the bits from the Diffusion Layer that we need in
4444-- this context.
4545serve ::
46+ StrictTMVar IO SockAddr ->
4647 SockAddr ->
4748 N2N. Versions
4849 N2N. NodeToNodeVersion
4950 N2N. NodeToNodeVersionData
5051 (OuroborosApplicationWithMinimalCtx 'Mux.ResponderMode SockAddr BL. ByteString IO Void () ) ->
5152 IO Void
52- serve sockAddr application = withIOManager \ iocp ->
53+ serve incomingTV sockAddr application = withIOManager \ iocp ->
5354 Server. with
5455 (Snocket. socketSnocket iocp)
5556 Snocket. makeSocketBearer
@@ -65,7 +66,7 @@ serve sockAddr application = withIOManager \iocp ->
6566 , haTimeLimits = Handshake. timeLimitsHandshake
6667 }
6768 (SomeResponderApplication <$> application)
68- (\ _ serverAsync -> wait serverAsync)
69+ (\ incoming serverAsync -> atomically (tryPutTMVar incomingTV incoming) * > wait serverAsync)
6970
7071run ::
7172 forall blk .
@@ -75,14 +76,16 @@ run ::
7576 , blk ~ TestBlock
7677 ) =>
7778 PeerResources IO blk ->
79+ -- | A TMVar for the connecting peer
80+ StrictTMVar IO SockAddr ->
7881 -- | A TMVar for the chainsync channel that we will fill in once the node connects.
7982 StrictTVar IO Bool ->
8083 -- | A TMVar for the blockfetch channel that we will fill in once the node connects.
8184 StrictTVar IO Bool ->
8285 SockAddr ->
8386 IO Void
84- run res csChanTMV bfChanTMV sockAddr = withRegistry \ _registry ->
85- serve sockAddr
87+ run res incomingTV csChanTMV bfChanTMV sockAddr = withRegistry \ _registry ->
88+ serve incomingTV sockAddr
8689 $ peerSimServer @ _ @ TestBlock
8790 res
8891 csChanTMV
0 commit comments