wifi: make "auth" command non-blocking, let aux/wpa do the waiting for bss scan to complete.
This commit is contained in:
parent
24e8c78cb2
commit
b6122a4c42
2 changed files with 7 additions and 16 deletions
|
@ -766,7 +766,6 @@ wifictl(Wifi *wifi, void *buf, long n)
|
|||
Cmdtab *ct;
|
||||
Wnode *wn;
|
||||
Wkey *k;
|
||||
int i;
|
||||
|
||||
cb = nil;
|
||||
if(waserror()){
|
||||
|
@ -818,16 +817,6 @@ wifictl(Wifi *wifi, void *buf, long n)
|
|||
setstatus(wifi, wn, Sconn);
|
||||
sendauth(wifi, wn);
|
||||
}
|
||||
/* wait 3 seconds for authentication response */
|
||||
for(i=0; i < 30; i++){
|
||||
if(wifi->bss != nil)
|
||||
goto done;
|
||||
if(!waserror()){
|
||||
tsleep(&up->sleep, return0, 0, 100);
|
||||
poperror();
|
||||
}
|
||||
}
|
||||
error("connect timeout");
|
||||
break;
|
||||
case CMbssid:
|
||||
memmove(wifi->bssid, addr, Eaddrlen);
|
||||
|
@ -859,7 +848,6 @@ wifictl(Wifi *wifi, void *buf, long n)
|
|||
setstatus(wifi, wn, Sassoc);
|
||||
break;
|
||||
}
|
||||
done:
|
||||
poperror();
|
||||
free(cb);
|
||||
return n;
|
||||
|
|
|
@ -531,7 +531,7 @@ main(int argc, char *argv[])
|
|||
char addr[128];
|
||||
uchar *rsne;
|
||||
int rsnelen;
|
||||
int n;
|
||||
int n, try;
|
||||
|
||||
quotefmtinstall();
|
||||
fmtinstall('H', Hfmt);
|
||||
|
@ -617,11 +617,14 @@ main(int argc, char *argv[])
|
|||
fprint(2, "rsne: %.*H\n", rsnelen, rsne);
|
||||
|
||||
/*
|
||||
* we use write() instead of fprint so message gets written
|
||||
* at once and not chunked up on fprint buffer.
|
||||
* we use write() instead of fprint so the message gets written
|
||||
* at once and not chunked up on fprint buffer. bss scan might
|
||||
* not be complete yet, so retry for 10 seconds.
|
||||
*/
|
||||
n = sprint((char*)buf, "auth %.*H", rsnelen, rsne);
|
||||
if(write(cfd, buf, n) != n)
|
||||
for(try = 10; try >= 0 && write(cfd, buf, n) != n; try--)
|
||||
sleep(1000);
|
||||
if(try < 0)
|
||||
sysfatal("write auth: %r");
|
||||
|
||||
if(!debug){
|
||||
|
|
Loading…
Reference in a new issue