INNER CODE UNIT · Rust

connect

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

    pub async fn connect() -> anyhow::Result<Self> {
        Self::connect_with_reconnect(true).await
    }

    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> {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…