Function lightning_net_tokio::connect_outbound [−][src]
pub async fn connect_outbound<CMH, RMH, L: ?Sized>(
peer_manager: Arc<PeerManager<SocketDescriptor, Arc<CMH>, Arc<RMH>, Arc<L>>>,
their_node_id: PublicKey,
addr: SocketAddr
) -> Option<impl Future<Output = ()>> where
CMH: ChannelMessageHandler + 'static + Send + Sync,
RMH: RoutingMessageHandler + 'static + Send + Sync,
L: Logger + 'static + Send + Sync,
Expand description
Process incoming messages and feed outgoing messages on a new connection made to the given socket address which is expected to be accepted by a peer with the given public key (by scheduling futures with tokio::spawn).
Shorthand for TcpStream::connect(addr) with a timeout followed by setup_outbound().
Returns a future (as the fn is async) which needs to be polled to complete the connection and connection setup. That future then returns a future which will complete when the peer is disconnected and associated handling futures are freed, though, because all processing in said futures are spawned with tokio::spawn, you do not need to poll the second future in order to make progress.