CanonicalLtd / UCWifiConnect

The code of this project has been moved to https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-connect
GNU General Public License v3.0
2 stars 2 forks source link

Daemon cannot change mode if no ssids available #38

Closed rmescandon closed 7 years ago

rmescandon commented 7 years ago

Once daemon loop starts searching for ssids and no one is found, command to enter in manual mode does not work as it gets stuck searching.

knitzsche commented 7 years ago

Roberto, Can you please provide the filtered log (wifi-connect msgs only) when this happens? I cannot yet reproduce. I just tried this with a modified version of scanSsids() method here: https://github.com/CanonicalLtd/UCWifiConnect/blob/issue38/daemon/daemon.go#L58

With that, the daemon loops, never finding SSIDs. But, I can stop (enter Manual mode) and start (entering STARTING mode): May 25 18:16:05 pi3dev snap[1267]: == wifi-connect: daemon STARTING May 25 18:16:52 pi3dev snap[1267]: == wifi-connect: entering MANAGEMENT mode May 25 18:16:54 pi3dev snap[1267]: == wifi-connect: No SSID found May 25 18:16:55 pi3dev snap[1267]: == wifi-connect: Looping. May 25 18:17:01 pi3dev snap[1267]: == wifi-connect: No SSID found May 25 18:17:02 pi3dev snap[1267]: == wifi-connect: Looping. May 25 18:17:09 pi3dev snap[1267]: == wifi-connect: No SSID found May 25 18:17:10 pi3dev snap[1267]: == wifi-connect: Looping. May 25 18:17:15 pi3dev snap[1267]: == wifi-connect: entering MANUAL mode May 25 18:17:30 pi3dev snap[1267]: == wifi-connect: entering STARTING mode May 25 18:17:30 pi3dev snap[1267]: == wifi-connect: daemon STARTING

rmescandon commented 7 years ago

I found the exact problem: Seems that daemon doesn't allow to enter in manual mode during first 45 seconds. That time loop is waiting (for external networks to be available?). If you enter in manual mode then, a new file is created to flag it. However, just after that sleep the file is removed, so any previous manual mode is taken into account and loop continues as if nothing had happened. I wonder if worths replace loop by some goroutines solution that allows any operation at any time, not needing for loop to reach certain code snippet evaluating certain condition

rmescandon commented 7 years ago

Correction: not able to enter in manual mode during first 40 seconds. Next 5 seconds that could be possible

knitzsche commented 7 years ago

cool. probably right that go routines with channels would be an improvement for this type of situation.