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

Start error using s2n_quic #61

Open
Jakubbuzalka opened this issue Mar 6, 2022 · 0 comments
Open

Start error using s2n_quic #61

Jakubbuzalka opened this issue Mar 6, 2022 · 0 comments

Comments

@Jakubbuzalka
Copy link

Jakubbuzalka commented Mar 6, 2022

I am using monoio with s2n_quic and when i wanted to start the server this error showed up:

Error: StartError(there is no reactor running, must be called from the context of a Tokio 1.x runtime)

My code:

use s2n_quic::Server;
use std::error::Error;
use monoio;

#[monoio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    println!("start ecexc");
    let mut server = Server::builder()
        .with_io("127.0.0.1:4433")?
        .start()?;
    println!("end");

    while let Some(mut connection) = server.accept().await {
      
        monoio::spawn(async move {
            while let Ok(Some(mut stream)) = connection.accept_bidirectional_stream().await {
               
                monoio::spawn(async move {
                    
                    while let Ok(Some(data)) = stream.receive().await {
                        stream.send(data).await.expect("stream should be open");
                    }
                });
            }
        });
    }

    Ok(())
}

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

No branches or pull requests

1 participant