fn new_instance(
        node_id: NodeId,
        conn: Pin<Box<quiche::Connection>>,
        endpoint: Endpoint,
        current_link: &Weak<Link>,
        commands: Option<futures::channel::mpsc::Sender<ClientPeerCommand>>,
    ) -> Result<Rc<Self>, Error> {
        log::trace!(
            "CREATE PEER FOR {:?}/{:?} CURRENT_LINK: {:?}",
            node_id,
            endpoint,
            Weak::upgrade(&current_link)
        );
        let conn = AsyncConnection::from_connection(conn, endpoint);
        let p = Rc::new(Self {
            endpoint,
            node_id,
            conn,
            current_link: Mutex::new(current_link.clone()),
            commands,
            conn_stats: Rc::new(PeerConnStats::default()),
            channel_proxy_stats: Rc::new(MessageStats::default()),
        });
        if let Some(link) = Weak::upgrade(current_link) {
            link.add_route_for_peer(&p);
        }
        Ok(p)
    }
// Common parts of new_client, new_server - create the peer object, get it routed
Common parts of new_client, new_server - create the peer object, get it routed
Common parts of new_client new_server - create the peer object get it routed
fn new_instance(
        node_id: NodeId,
        conn: Pin<Box<quiche::Connection>>,
        endpoint: Endpoint,
        current_link: &Weak<Link>,
        commands: Option<futures::channel::mpsc::Sender<ClientPeerCommand>>,
    ) -> Result<Rc<Self>, Error> {
        log::trace!(
            "CREATE PEER FOR {:?}/{:?} CURRENT_LINK: {:?}",
            node_id,
            endpoint,
            Weak::upgrade(&current_link)
        );
        let conn = AsyncConnection::from_connection(conn, endpoint);
        let p = Rc::new(Self {
            endpoint,
            node_id,
            conn,
            current_link: Mutex::new(current_link.clone()),
            commands,
            conn_stats: Rc::new(PeerConnStats::default()),
            channel_proxy_stats: Rc::new(MessageStats::default()),
        });
        if let Some(link) = Weak::upgrade(current_link) {
            link.add_route_for_peer(&p);
        }
        Ok(p)
    }
fn new_instance ( node_id : NodeId , conn : Pin < Box < quiche :: Connection > > , endpoint : Endpoint , current_link : & Weak < Link > , commands : Option < futures :: channel :: mpsc :: Sender < ClientPeerCommand > > , ) -> Result < Rc < Self > , Error > { log :: trace ! ( " " node_id endpoint Weak upgrade ( current_link ) ) ; let conn = AsyncConnection :: from_connection ( conn , endpoint ) ; let p = Rc :: new ( Self { endpoint , node_id , conn , current_link : Mutex :: new ( current_link . clone ( ) ) , commands , conn_stats : Rc :: new ( PeerConnStats :: default ( ) ) , channel_proxy_stats : Rc :: new ( MessageStats :: default ( ) ) , } ) ; if let Some ( link ) = Weak :: upgrade ( current_link ) { link . add_route_for_peer ( & p ) ; } Ok ( p ) }
Common parts of new_client, new_server - create the peer object, get it routed
Common parts of new_client new_server - create the peer object get it routed
node_id
NodeId
conn
Pin<Box<quiche::Connection>>
endpoint
Endpoint
current_link
&Weak<Link>
commands
Option<futures::channel::mpsc::Sender<ClientPeerCommand>>
node_id
NodeId
conn
Pin<Box<quiche::Connection>>
endpoint
Endpoint
current_link
&Weak<Link>
commands
Option<futures::channel::mpsc::Sender<ClientPeerCommand>>