Skip to content

why call set_options blocked the application #138

@mycoco2014

Description

@mycoco2014

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions