diff --git a/Cargo.toml b/Cargo.toml index f329dff..06f0722 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ esp-println = { version = "0.12.0", features = ["log"] } esp-hal-embassy = { version = "0.4.0", optional = true } embassy-time = { version = "0.3.0", optional = true } -embassy-executor = { version = "0.6.0", package = "embassy-executor", features = [ +embassy-executor = { version = "=0.6.0", package = "embassy-executor", features = [ "nightly", "integrated-timers", ], optional = true } @@ -149,6 +149,11 @@ edge-server = [ # Patch until new release [patch.crates-io] -edge-http = { git = "https://github.com/ivmarkov/edge-net", rev = "f90468953aec1d476ba52fe3b63f392a07bb9daa" } -edge-nal = { git = "https://github.com/ivmarkov/edge-net", rev = "f90468953aec1d476ba52fe3b63f392a07bb9daa" } -edge-nal-embassy = { git = "https://github.com/ivmarkov/edge-net", rev = "f90468953aec1d476ba52fe3b63f392a07bb9daa" } +edge-http = { git = "https://github.com/ivmarkov/edge-net", rev = "722f92ac0fffd0cb1e1ce76086cca58df6eb49ee" } +edge-nal = { git = "https://github.com/ivmarkov/edge-net", rev = "722f92ac0fffd0cb1e1ce76086cca58df6eb49ee" } +edge-nal-embassy = { git = "https://github.com/ivmarkov/edge-net", rev = "722f92ac0fffd0cb1e1ce76086cca58df6eb49ee" } + +# Patch before 0.6.0 got yanked +embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "886580179ff250e15b0fad6448e8ebed6cdabf2b" } +embassy-time-driver = { git = "https://github.com/embassy-rs/embassy", rev = "886580179ff250e15b0fad6448e8ebed6cdabf2b" } +embassy-time-queue-driver = { git = "https://github.com/embassy-rs/embassy", rev = "886580179ff250e15b0fad6448e8ebed6cdabf2b" } diff --git a/examples/edge_server.rs b/examples/edge_server.rs index 9cb70d2..e5c1fd4 100644 --- a/examples/edge_server.rs +++ b/examples/edge_server.rs @@ -18,7 +18,7 @@ use edge_http::io::Error; use edge_http::Method; use edge_nal_embassy::{Tcp, TcpBuffers}; -use embedded_io_async::{ErrorType, Read, Write}; +use embedded_io_async::{Read, Write}; use embassy_net::{Config, Stack, StackResources}; @@ -34,7 +34,7 @@ use esp_wifi::wifi::{ WifiState, }; use esp_wifi::{init, EspWifiInitFor}; -use hal::{peripherals::SHA, prelude::*, rng::Rng, timer::timg::TimerGroup}; +use hal::{prelude::*, rng::Rng, timer::timg::TimerGroup}; // Patch until https://github.com/embassy-rs/static-cell/issues/16 is fixed macro_rules! mk_static { @@ -144,16 +144,10 @@ async fn main(spawner: Spawner) -> ! { set_debug(0); - let server = mk_static!(HttpsServer, HttpsServer::new()); - let buffers = mk_static!(TcpBuffers, TcpBuffers::::new()); - let tls_buffers = mk_static!( - esp_mbedtls::asynch::TlsBuffers::, - esp_mbedtls::asynch::TlsBuffers::::new() - ); - let tcp = mk_static!( - Tcp<'_, WifiDevice<'_, WifiStaDevice>, SERVER_SOCKETS, TX_SIZE, RX_SIZE>, - Tcp::new(stack, buffers) - ); + let mut server = HttpsServer::new(); + let buffers = TcpBuffers::::new(); + let tls_buffers = esp_mbedtls::asynch::TlsBuffers::::new(); + let tcp = Tcp::new(stack, &buffers); let certificates = Certificates { // Use self-signed certificates @@ -164,16 +158,14 @@ async fn main(spawner: Spawner) -> ! { ..Default::default() }; - let sha = mk_static!(SHA, peripherals.SHA); - loop { let tls_acceptor = esp_mbedtls::asynch::TlsAcceptor::new( - tcp, - tls_buffers, + &tcp, + &tls_buffers, 443, TlsVersion::Tls1_2, certificates, - &mut *sha, + &mut peripherals.SHA, ) .await .with_hardware_rsa(&mut peripherals.RSA); @@ -198,18 +190,17 @@ async fn main(spawner: Spawner) -> ! { struct HttpHandler; -impl<'b, T, const N: usize> Handler<'b, T, N> for HttpHandler -where - T: Read + Write, - T::Error: Send + Sync, -{ - type Error = Error<::Error>; +impl Handler for HttpHandler { + type Error = Error where E: core::fmt::Debug; - async fn handle( + async fn handle( &self, _task_id: impl core::fmt::Display + Copy, - connection: &mut Connection<'b, T, N>, - ) -> Result<(), Self::Error> { + connection: &mut Connection<'_, T, N>, + ) -> Result<(), Self::Error> + where + T: Read + Write, + { println!("Got new connection"); let headers = connection.headers()?;