network-transport-composed-0.2.1: Compose network transports

Safe HaskellNone



Combine two transports into a single new transport

Given two transports A and B, endpoints in the combined transport are pairs of endpoints for the underlying transports. Consequently, the address of an endpoint in the combined transport is a pair of addresses of the two underlying endpoints. Events from both underlying endpoints are posted to the combined endpoint.

When the address of combined endpoint C1 is sent to combined endpoint C2, and C2 attempts to make a connection to C1, it needs to choice an underlying endpoint to make the connection. The choice is made by a parameter resolveAddress of the composed transport.

When C2 connects to C1 then it is assumed that whatever transport C2 uses to connect to C1, this is the same transport that C1 needs to use to connect back to C2.

TODO: at the moment the address reported by a ConnectionOpened might differ from the address reported by the remote endpoint itself. This might cause difficulties?


data ComposedTransport Source #