Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sockets &引用;“资源暂时不可用”;尝试使用ws-rs(mio)连接到https websocket时_Sockets_Ssl_Websocket_Rust_Mio - Fatal编程技术网

Sockets &引用;“资源暂时不可用”;尝试使用ws-rs(mio)连接到https websocket时

Sockets &引用;“资源暂时不可用”;尝试使用ws-rs(mio)连接到https websocket时,sockets,ssl,websocket,rust,mio,Sockets,Ssl,Websocket,Rust,Mio,我正在尝试使用Rust(基于mio)建立安全连接 我认为代码中与此相关的部分: impl ws::Handler for Client { fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> { println!("msg = {}", msg); self.out.close(ws::CloseCode::Normal) } fn upgra

我正在尝试使用Rust(基于mio)建立安全连接

我认为代码中与此相关的部分:

impl ws::Handler for Client {
    fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
        println!("msg = {}", msg);
        self.out.close(ws::CloseCode::Normal)
    }

    fn upgrade_ssl_client(
        &mut self,
        sock: TcpStream,
        _: &url::Url,
    ) -> ws::Result<SslStream<TcpStream>> {
        let mut builder = SslConnector::builder(SslMethod::tls()).map_err(|e| {
            ws::Error::new(
                ws::ErrorKind::Internal,
                format!("Failed to upgrade client to SSL: {}", e),
            )
        })?;
        builder.set_verify(SslVerifyMode::empty());

        let connector = builder.build()
            .configure()
            .unwrap()
            .use_server_name_indication(false)
            .verify_hostname(false)
            .connect("localhost:12321", sock)
            .unwrap();

        Ok(connector)
    }
}
我真的不知道那是什么意思

(我上个月还创建了一个ws-rs-Github,因为我认为这可能是lib或示例的问题)

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
WouldBlock(MidHandshakeSslStream {
    stream: SslStream {
        stream: TcpStream { addr: V4(127.0.0.1:52164), peer: V4(127.0.0.1:12321), fd: 12 },
        ssl: Ssl { state: "SSLv2/v3 read server hello A", verify_result: X509VerifyResult { code: 0, error: "ok" } }
    }, error: Error {
        code: ErrorCode(2),
        cause: Some(Io(Os {
            code: 11,
            kind: WouldBlock,
            message: "Resource temporarily unavailable"
        }))
    }
})