SetSSID seems to race the async event polling
Closed this issue ยท 3 comments
Thank you for all the hard work you put into this library. Using it, and getting started with it, was super straight forward and a pleasure ๐.
When I attempt to join my WiFi network I noticed that the setSSID
call seemed to race the subsequent async status poll. Join events would repeatedly fail in state
linkStateUpWaitForSSID
.
As a test/hack/workaround: adding a 100ms delay after the setSSID
call made the WiFi join work reliably.
@csweichel Thanks for your kind words <3
setSSID call seemed to race the subsequent async status poll.
Hmm, not sure I understand- setSSID blocks until all I/O completes โ , and the lock to the device is held the whole time by JoinWPA2 , so there's no competing goroutine access as far as I can tell.
That said- now you do mention it I do see a race happening between the call to doIoctlSet
inside setSSID
and the subsequent setting of the state
field since ioctl methods will process any packet received inside of rx
, including Events that may modify state
.
If this is a true race then I'd imagine a possible fix to this would be setting the state
field within setSSID
right before doIoctlSet
is called, since setSSID
starts the connection process anyways.
โ Note: In latest main
branch.
@csweichel I've managed to replicate this behaviour and tested out your fix and had good results. Thank you for your suggestions! Are you able to test #38 ?
@csweichel I'll keep this one open for a week before closing as it seems your suggestions yielded great results in PR #38.