// Keep the boilerplate DRY. This create a peer, spawns it and observes it.
//
Keep the boilerplate DRY. This create a peer, spawns it and observes it.
Keep the boilerplate DRY . This create a peer spawns it and observes it .
async fn peer_connect
(
	socket: Endpoint      ,
	exec  : impl PeerExec ,
	name  : &str          ,
)
	-> (WeakAddr<Peer>, Events<PeerEvent>, JoinHandle<()>)
{
	// create peer with stream/sink + service map
	//
	let (mut peer, peer_mb, peer_addr) = CborWF::create_peer( name, socket, 1024, 1024, exec.clone(), None, None ).expect( "spawn peer" );
	let evts = peer.observe( ObserveConfig::default() ).await.expect( "pharos not closed" );
	debug!( "start mailbox for [{}] in peer_connect", name );
	let handle = exec.spawn_handle( peer_mb.start(peer).map(|_|()) ).expect( "start mailbox of Peer" );
	(peer_addr, evts, handle)
}
async fn peer_connect ( socket : Endpoint , exec : impl PeerExec , name : & str , ) -> ( WeakAddr < Peer > , Events < PeerEvent > , JoinHandle < ( ) > ) { // create peer with stream/sink + service map // let ( mut peer , peer_mb , peer_addr ) = CborWF :: create_peer ( name , socket , 1024 , 1024 , exec . clone ( ) , None , None ) . expect ( " " ) ; let evts = peer . observe ( ObserveConfig :: default ( ) ) . await . expect ( " " ) ; debug ! ( " " name ) ; let handle = exec . spawn_handle ( peer_mb . start ( peer ) . map ( | _ | ( ) ) ) . expect ( " " ) ; ( peer_addr , evts , handle ) }
Keep the boilerplate DRY.
Keep the boilerplate DRY .
socket
Endpoint
exec
impl PeerExec
name
&str