aboutsummaryrefslogtreecommitdiff
path: root/src/control.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/control.rs')
-rw-r--r--src/control.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/control.rs b/src/control.rs
index 824c55125..0c06009b9 100644
--- a/src/control.rs
+++ b/src/control.rs
@@ -197,18 +197,20 @@ impl<'a> Control<'a> {
197 async fn wait_for_join(&mut self, i: SsidInfo) { 197 async fn wait_for_join(&mut self, i: SsidInfo) {
198 self.events.mask.enable(&[Event::JOIN, Event::AUTH]); 198 self.events.mask.enable(&[Event::JOIN, Event::AUTH]);
199 let mut subscriber = self.events.queue.subscriber().unwrap(); 199 let mut subscriber = self.events.queue.subscriber().unwrap();
200 // the actual join operation starts here
201 // we make sure to enable events before so we don't miss any
200 self.ioctl(IoctlType::Set, IOCTL_CMD_SET_SSID, 0, &mut i.to_bytes()) 202 self.ioctl(IoctlType::Set, IOCTL_CMD_SET_SSID, 0, &mut i.to_bytes())
201 .await; 203 .await;
202 // set_ssid 204 // set_ssid
203 205
204 loop { 206 loop {
205 let msg = subscriber.next_message_pure().await; 207 let msg = subscriber.next_message_pure().await;
206 if msg.header.event_type == Event::AUTH && msg.header.status != 0 { 208 if msg.header.event_type == Event::AUTH && msg.header.status != EStatus::SUCCESS {
207 // retry 209 // retry
208 warn!("JOIN failed with status={}", msg.header.status); 210 warn!("JOIN failed with status={}", msg.header.status);
209 self.ioctl(IoctlType::Set, IOCTL_CMD_SET_SSID, 0, &mut i.to_bytes()) 211 self.ioctl(IoctlType::Set, IOCTL_CMD_SET_SSID, 0, &mut i.to_bytes())
210 .await; 212 .await;
211 } else if msg.header.event_type == Event::JOIN && msg.header.status == 0 { 213 } else if msg.header.event_type == Event::JOIN && msg.header.status == EStatus::SUCCESS {
212 // successful join 214 // successful join
213 break; 215 break;
214 } 216 }