INNER CODE UNIT · Rust

connect_with_reconnect

ilya-zlobintsev/LACT · lact-client/src/lib.rs:47

    pub async fn connect_with_reconnect(reconnect: bool) -> anyhow::Result<Self> {
        let path = get_socket_path()
            .ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "socket file not found"))?;
        let stream = UnixConnection::connect(&path).await?;

        Ok(Self {
            stream: Rc::new(Mutex::new(stream)),
            embedded: false,
            reconnect,
            status_tx: broadcast::Sender::new(STATUS_MSG_CHANNEL_SIZE),
        })
    }

    pub async fn connect_tcp(addr: impl ToSocketAddrs) -> anyhow::Result<Self> {
        let stream = TcpConnection::connect(addr).await?;

        Ok(Self {
            stream: Rc::new(Mutex::new(stream)),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…