BiagioFesta / wtransport

Async-friendly WebTransport implementation in Rust
Apache License 2.0
402 stars 27 forks source link

dnsResolver is not send #98

Closed cBournhonesque closed 10 months ago

cBournhonesque commented 10 months ago

Hi, I had to upgrade to master to get a Certificate struct that derives Clone. However my future doesn't work anymore

        tokio::spawn(async move {
            let config = ClientConfig::builder()
                .with_bind_address(client_addr)
                .with_no_cert_validation()
                .build();
            let server_url = format!("https://{}", server_addr);
            debug!(
                "Starting client webtransport task with server url: {}",
                &server_url
            );
            let Ok(connection) = wtransport::Endpoint::client(config)
                .unwrap()
                .connect(server_url)
                .await
            else {
                error!("failed to connect to server");
                return;
            };
     })

The error I get is

help: the trait `Send` is not implemented for `(dyn DnsResolver + 'static)`
note: future is not `Send` as this value is used across an await

Which I did not get on 0.1.8 Is that expected? How can i get around this?

BiagioFesta commented 10 months ago

Thanks for your feedback.

Client configurations now carries dynamic type for DNS resolution which seems to inhibits passing around threads

I will work on it

BiagioFesta commented 10 months ago

This should be solved now in master.

Please try gain and let me know. If the issue persists, please re-open this issue

cBournhonesque commented 10 months ago

Thanks for the super quick response; this works for me!