Skip to content

Commit

Permalink
ConnectionId: use named field puns
Browse files Browse the repository at this point in the history
Make `ConnectionId` use sites independent of the order of `ConnectionId`
fields.
  • Loading branch information
coot committed May 6, 2024
1 parent c326752 commit f698386
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ouroboros-network-framework/src/Ouroboros/Network/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ connectToNode'
-- ^ a configured socket to use to connect to a remote service provider
-> IO ()
connectToNode' sn makeBearer handshakeCodec handshakeTimeLimits versionDataCodec NetworkConnectTracers {nctMuxTracer, nctHandshakeTracer } handshakeCallbacks versions sd = do
connectionId <- ConnectionId <$> Snocket.getLocalAddr sn sd <*> Snocket.getRemoteAddr sn sd
connectionId <- (\localAddress remoteAddress -> ConnectionId { localAddress, remoteAddress })
<$> Snocket.getLocalAddr sn sd <*> Snocket.getRemoteAddr sn sd
muxTracer <- initDeltaQTracer' $ Mx.WithMuxBearer connectionId `contramap` nctMuxTracer
ts_start <- getMonotonicTime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,8 @@ mkSnocket state tr = Snocket { getLocalAddr
-- state. So we take from the StrictTBQueue until we have found
-- one that is SYN_SENT state.
cwi <- readTBQueueUntil (synSent localAddress) queue
let connId = ConnectionId localAddress (cwiAddress cwi)
let connId = ConnectionId { localAddress,
remoteAddress = cwiAddress cwi }

case deltaAndIOErrType of
-- the `ctime` is the time when we issued 'accept' not
Expand Down

0 comments on commit f698386

Please sign in to comment.