Open
Description
-- Identifies a "heavyweight" connection which carries 0 or more "lightweight"
-- connections.
type ConnectionBundle = Word32
data ErrorEvent =
...
-- EventConnectionLost indicates which bundle was lost
| EventConnectionLost EndPointAddress ConnectionBundle
...
data Connection = Connection {
...
-- Each connection knows which bundle carries it.
, bundle :: ConnectionBundle
}
Why?
When a connection is lost, an EventConnectionLost peer
must be posted and ultimately come out of receive
at that end point before any ConnectionOpened
events to the same peer
. While that event sits in the queue, new connections may be established to that same peer
. Once the EventConnectionLost peer
comes out of the queue it's impossible to determine which of the existing outbound lightweight connections are affected by it. By including a ConnectionBundle
on every Connection
and on the EventConnectionLost
, it's possible to determine whether an outbound connection has been severed without trying to send on it.