The establishing side of a datagram-oriented transport.
A connector opens outbound connections to a remote peer, performing any necessary protocol-level configuration and establishment, then provides a handle which is used to read to or write from that socket.
Any ReliableConnector is also a Connector and can be passed wherever a Connector is expected.
The Connector interface does not specify any addressing or ports, as those details are protocol-dependent. A concrete Connector instance should be constructed with and internally store any such state if required.
Implementations override DoConnect() and return a Connector::ConnectFuture.
If a Connector is destructed, it must resolve any pending ConnectFuture objects with a FAILED_PRECONDITION.
Classes | |
| class | ConnectFuture |
Public Member Functions | |
| ConnectFuture | Connect () |
Protected Types | |
| using | ConnectProvider = internal::TransportFutureProvider< ConnectFuture > |
One-to-one provider that vends ConnectFuture instances. | |
| using | ConnectListProvider = internal::TransportFutureListProvider< ConnectFuture > |
Static Protected Member Functions | |
| static Socket | WrapSocket (SocketImpl &impl) |
Creates a Socket handle from an implementation. | |
Private Member Functions | |
| virtual ConnectFuture | DoConnect ()=0 |
| Implements opening an outbound connection to the peer. | |
|
protected |
Multi-consumer provider that vends a list of pending ConnectFuture instances.
|
inline |
Opens a connection to the peer, returning it once established.
It is up to the implementation to decide whether concurrent connections to the peer are allowed. If not supported, subsequent calls to Connect when a connection is active should return ALREADY_EXISTS. It must always be possible to call Connect again when no connections are active and the transport is still alive.
|
privatepure virtual |
Implements opening an outbound connection to the peer.
Implemented in pw::transport::internal::MockConnectorBase< Connector, kMaxQueuedResults >, and pw::transport::ReliableConnector.