@@ -92,10 +92,10 @@ withHeartbeat ::
92
92
-- | Callback listening to peers' status change as computed by the `withIncomingHeartbeat` layer.
93
93
ConnectionMessages m ->
94
94
-- | Underlying `NetworkComponent` for sending and consuming `Heartbeat` messages.
95
- NetworkComponent m (Heartbeat msg1 ) (Heartbeat msg ) a ->
95
+ NetworkComponent m (Heartbeat inbound ) (Heartbeat outbound ) a ->
96
96
-- | Returns a network component that can be used to send and consume arbitrary messages.
97
97
-- This layer will take care of peeling out/wrapping messages into `Heartbeat`s.
98
- NetworkComponent m msg1 msg a
98
+ NetworkComponent m inbound outbound a
99
99
withHeartbeat nodeId connectionMessages withNetwork =
100
100
withIncomingHeartbeat connectionMessages $
101
101
withOutgoingHeartbeat nodeId withNetwork
@@ -107,8 +107,8 @@ withIncomingHeartbeat ::
107
107
ConnectionMessages m ->
108
108
-- | Underlying `NetworkComponent`.
109
109
-- We only care about the fact it notifies us with `Heartbeat` messages.
110
- NetworkComponent m (Heartbeat msg1 ) msg a ->
111
- NetworkComponent m msg1 msg a
110
+ NetworkComponent m (Heartbeat inbound ) outbound a ->
111
+ NetworkComponent m inbound outbound a
112
112
withIncomingHeartbeat connectionMessages withNetwork callback action = do
113
113
heartbeat <- newTVarIO initialHeartbeatState
114
114
withNetwork (updateStateFromIncomingMessages heartbeat connectionMessages callback) $ \ network ->
@@ -119,8 +119,8 @@ updateStateFromIncomingMessages ::
119
119
(MonadSTM m , MonadMonotonicTime m ) =>
120
120
TVar m HeartbeatState ->
121
121
ConnectionMessages m ->
122
- NetworkCallback msg m ->
123
- NetworkCallback (Heartbeat msg ) m
122
+ NetworkCallback inbound m ->
123
+ NetworkCallback (Heartbeat inbound ) m
124
124
updateStateFromIncomingMessages heartbeatState connectionMessages callback = \ case
125
125
Data nodeId msg -> notifyAlive nodeId >> callback msg
126
126
Ping nodeId -> notifyAlive nodeId
@@ -143,8 +143,8 @@ withOutgoingHeartbeat ::
143
143
NodeId ->
144
144
-- | Underlying `NetworkComponent`.
145
145
-- We only care about the fact it allows us to broadcast `Heartbeat` messages.
146
- NetworkComponent m msg1 (Heartbeat msg ) a ->
147
- NetworkComponent m msg1 msg a
146
+ NetworkComponent m inbound (Heartbeat outbound ) a ->
147
+ NetworkComponent m inbound outbound a
148
148
withOutgoingHeartbeat nodeId withNetwork callback action = do
149
149
lastSent <- newTVarIO Nothing
150
150
withNetwork callback $ \ network ->
@@ -155,8 +155,8 @@ updateStateFromOutgoingMessages ::
155
155
(MonadSTM m , MonadMonotonicTime m ) =>
156
156
NodeId ->
157
157
TVar m (Maybe Time ) ->
158
- Network m (Heartbeat msg ) ->
159
- Network m msg
158
+ Network m (Heartbeat outbound ) ->
159
+ Network m outbound
160
160
updateStateFromOutgoingMessages nodeId lastSent Network {broadcast} =
161
161
Network $ \ msg -> do
162
162
now <- getMonotonicTime
@@ -172,7 +172,7 @@ checkHeartbeatState ::
172
172
) =>
173
173
NodeId ->
174
174
TVar m (Maybe Time ) ->
175
- Network m (Heartbeat msg ) ->
175
+ Network m (Heartbeat outbound ) ->
176
176
m ()
177
177
checkHeartbeatState nodeId lastSent Network {broadcast} =
178
178
forever $ do
0 commit comments