diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-02 21:20:00 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-02 21:20:00 +0100 |
| commit | 9bee576fd241f019c363919b0c29551c6b8ee4b2 (patch) | |
| tree | 96bfb71546ab96b02cb5c26d6b754793e4bd64e9 /embassy-net/src/stack.rs | |
| parent | f100383b3c094830fee4e54956795388bd5edec1 (diff) | |
Update embassy
Diffstat (limited to 'embassy-net/src/stack.rs')
| -rw-r--r-- | embassy-net/src/stack.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/embassy-net/src/stack.rs b/embassy-net/src/stack.rs index 8f63db971..f8a945a54 100644 --- a/embassy-net/src/stack.rs +++ b/embassy-net/src/stack.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use core::cell::RefCell; | ||
| 1 | use core::future::Future; | 2 | use core::future::Future; |
| 2 | use core::task::Context; | 3 | use core::task::Context; |
| 3 | use core::task::Poll; | 4 | use core::task::Poll; |
| 4 | use core::{cell::RefCell, future}; | ||
| 5 | use embassy::time::{Instant, Timer}; | 5 | use embassy::time::{Instant, Timer}; |
| 6 | use embassy::util::ThreadModeMutex; | 6 | use embassy::util::ThreadModeMutex; |
| 7 | use embassy::util::{Forever, WakerRegistration}; | 7 | use embassy::util::{Forever, WakerRegistration}; |
| @@ -110,7 +110,7 @@ impl Stack { | |||
| 110 | self.waker.register(cx.waker()); | 110 | self.waker.register(cx.waker()); |
| 111 | 111 | ||
| 112 | let timestamp = instant_to_smoltcp(Instant::now()); | 112 | let timestamp = instant_to_smoltcp(Instant::now()); |
| 113 | if let Err(e) = self.iface.poll(&mut self.sockets, timestamp) { | 113 | if let Err(_) = self.iface.poll(&mut self.sockets, timestamp) { |
| 114 | // If poll() returns error, it may not be done yet, so poll again later. | 114 | // If poll() returns error, it may not be done yet, so poll again later. |
| 115 | cx.waker().wake_by_ref(); | 115 | cx.waker().wake_by_ref(); |
| 116 | return; | 116 | return; |
| @@ -174,6 +174,9 @@ pub fn init(device: &'static mut dyn Device, configurator: &'static mut dyn Conf | |||
| 174 | 174 | ||
| 175 | let sockets = SocketSet::new(&mut res.sockets[..]); | 175 | let sockets = SocketSet::new(&mut res.sockets[..]); |
| 176 | 176 | ||
| 177 | let local_port = LOCAL_PORT_MIN; | ||
| 178 | |||
| 179 | /* | ||
| 177 | let local_port = loop { | 180 | let local_port = loop { |
| 178 | let mut res = [0u8; 2]; | 181 | let mut res = [0u8; 2]; |
| 179 | embassy::rand::rand(&mut res); | 182 | embassy::rand::rand(&mut res); |
| @@ -182,6 +185,7 @@ pub fn init(device: &'static mut dyn Device, configurator: &'static mut dyn Conf | |||
| 182 | break port; | 185 | break port; |
| 183 | } | 186 | } |
| 184 | }; | 187 | }; |
| 188 | */ | ||
| 185 | 189 | ||
| 186 | let stack = Stack { | 190 | let stack = Stack { |
| 187 | iface, | 191 | iface, |
