Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why call set_options blocked the application #138

Open
mycoco2014 opened this issue Jul 11, 2022 · 0 comments
Open

why call set_options blocked the application #138

mycoco2014 opened this issue Jul 11, 2022 · 0 comments

Comments

@mycoco2014
Copy link

mycoco2014 commented Jul 11, 2022

i have a demo both tokio_native_tls and async_native_tls will be blocked after set_options.

pub async fn test_tls_client()  {
    let addr = "14.215.177.39:443";
    let host = "www.baidu.com";

    let socket = TcpStream::connect(addr.clone()).await?;
    let cx = TlsConnector::builder().build()?;
    let cx = tokio_native_tls::TlsConnector::from(cx);

    let mut socket = cx.connect(host.clone(), socket).await?; // *** blocked there 

    socket.write_all(format!("\
             GET / HTTP/1.0\r\n\
             Host: {}\r\n\
             \r\n\
             ",host.clone())
                .as_bytes(),
        ).await?;

    let mut data = Vec::new();
    socket.read_to_end(&mut data).await?;
    println!("recv tls {}", String::from_utf8_lossy(&data[..]));
}

fn main() {
   std::thread::spawn(move || test_tls_client());
    use sciter::SCRIPT_RUNTIME_FEATURES::*;
    sciter::set_options(sciter::RuntimeOptions::ScriptFeatures(
       ALLOW_FILE_IO as u8
    ));
    let mut frame = sciter::WindowBuilder::main_window().create();
    frame.load_file("./src/minimal.htm");
    frame.run_app();
}

if i inited options by set_options function, then request tls will be block this demo.

what's the default options? why is blocked demo in https client?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant