An in-memory ReliableListener and ReliableConnector that pairs outbound Connect() calls with inbound Accept() calls.
Each matched Connect() and Accept() creates a connected pair of in-memory ReliableSockets allocated from allocator that forward datagrams to each other without copying.
Connect() and Accept() may be called in either order and from multiple tasks concurrently. Unmatched calls remain pending in FIFO order until a peer call arrives or the future is canceled; no sockets are allocated until both sides are present. If allocator cannot allocate the sockets, pending Connect() futures resolve to RESOURCE_EXHAUSTED while the listener remains active for subsequent connections.
On destruction, any still-pending Accept() and Connect() futures resolve to FAILED_PRECONDITION. Sockets from already-established connections remain open; allocator must outlive them and must not block (both sockets in a connection share an InterruptSpinLock, and allocator is called while that lock is held).
Public Member Functions | |
| ForwardingTransport (Allocator &allocator, const ForwardingSocketOptions &options={}) | |
| ~ForwardingTransport () override | |
| ForwardingTransport (const ForwardingTransport &)=delete | |
| ForwardingTransport & | operator= (const ForwardingTransport &)=delete |
| ForwardingTransport (ForwardingTransport &&)=delete | |
| ForwardingTransport & | operator= (ForwardingTransport &&)=delete |
Public Member Functions inherited from pw::transport::ReliableListener | |
| AcceptFuture | Accept () |
Public Member Functions inherited from pw::transport::Listener | |
| AcceptFuture | Accept () |
Public Member Functions inherited from pw::transport::ReliableConnector | |
| ConnectFuture | Connect () |
Public Member Functions inherited from pw::transport::Connector | |
| ConnectFuture | Connect () |
Private Member Functions | |
| ReliableListener::AcceptFuture | DoAcceptReliable () override |
| Implements accepting a reliable inbound connection from a peer. | |
| ReliableConnector::ConnectFuture | DoConnectReliable () override |
| Implements opening a reliable outbound connection to the peer. | |
Additional Inherited Members | |
Protected Types inherited from pw::transport::ReliableListener | |
| using | AcceptProvider = internal::TransportFutureProvider< AcceptFuture > |
One-to-one provider that vends AcceptFuture instances. | |
| using | AcceptListProvider = internal::TransportFutureListProvider< AcceptFuture > |
Protected Types inherited from pw::transport::Listener | |
| using | AcceptProvider = internal::TransportFutureProvider< AcceptFuture > |
One-to-one provider that vends AcceptFuture instances. | |
| using | AcceptListProvider = internal::TransportFutureListProvider< AcceptFuture > |
Protected Types inherited from pw::transport::ReliableConnector | |
| using | ConnectProvider = internal::TransportFutureProvider< ConnectFuture > |
One-to-one provider that vends ConnectFuture instances. | |
| using | ConnectListProvider = internal::TransportFutureListProvider< ConnectFuture > |
Protected Types inherited from pw::transport::Connector | |
| using | ConnectProvider = internal::TransportFutureProvider< ConnectFuture > |
One-to-one provider that vends ConnectFuture instances. | |
| using | ConnectListProvider = internal::TransportFutureListProvider< ConnectFuture > |
Static Protected Member Functions inherited from pw::transport::ReliableListener | |
| static ReliableSocket | WrapSocket (ReliableSocketImpl &impl) |
Creates a ReliableSocket handle from an implementation. | |
Static Protected Member Functions inherited from pw::transport::Listener | |
| static Socket | WrapSocket (SocketImpl &impl) |
Creates a Socket handle from an implementation. | |
Static Protected Member Functions inherited from pw::transport::ReliableConnector | |
| static ReliableSocket | WrapSocket (ReliableSocketImpl &impl) |
Creates a ReliableSocket handle from an implementation. | |
Static Protected Member Functions inherited from pw::transport::Connector | |
| static Socket | WrapSocket (SocketImpl &impl) |
Creates a Socket handle from an implementation. | |
|
explicit |
Creates an in-memory transport that allocates connected sockets and their buffers from allocator using options.
| [in,out] | allocator | Allocator used for socket endpoints, queues, and write buffers. |
| [in] | options | Queue depth and maximum message size for each established connection. |
options.queue_depth > 0 (crash-asserts otherwise). allocator must outlive this ForwardingTransport and all sockets produced by it, and must not block.
|
override |
Resolves any pending Accept() and Connect() futures with FAILED_PRECONDITION. Sockets from already-established connections remain open.
|
overrideprivatevirtual |
Implements accepting a reliable inbound connection from a peer.
Implements pw::transport::ReliableListener.
|
overrideprivatevirtual |
Implements opening a reliable outbound connection to the peer.
Implements pw::transport::ReliableConnector.