Conversation
Add helper methods for reading a line from the socket, and for sending a request and waiting for the response.
It adds a debug log message if there is no listener for the boradcasts.
This is to allow the runner to keep going if there is an issue with any single response from the wpa_supplicant. IO errors indicate that the socket is broken so still go to the worker so it can be reconnected.
Sometime the scan request will return OK but the WiFi driver will fail to start a scan. This results in a scan failed event. The request then needs to get an error to aviod hanging forever.
This splits the error type into two: SocketError: for anything IO related Error: for anything user/protocol related Socket errors go stop the runners which can then reconnect or what ever other apropriate action is needed Other errors go to the client caller who can try and correct the malformed inputs. I also reorganised and simplified the errors.
The channel was complicating error handling and not adding much as both sides of the channel were going into the same select!() call. The channel for broadcast requests remains.
|
Hi, Sorry for taking so long to post this follow up pull request with my changes to the error handling. The first four commits (up to when I split the Error enum ) should be backwards compatible, the last two ("Split Error enum" and "Remove event Channel") are where the big changes are. I'm posting this more as a starter for discussion to see if you are still interested in the idea. If you don't like it, just say so and it can go straight to I'm not sure I like how much I am still leaking internal details e.g. in I am also not sure about how to treat And finally there is the broader issue of timeouts, my gut feel is that there are still ways in which the clients can hang indefinitely, and every request should have a similar timeout mechanism to |
Only strip the trailing new line on reponses before parsing The scan results are tab separated and if the ssid is empty it can end with a tab which breaks the parsing if removed.
5d4023e to
feb28d2
Compare
Refactor the error handling: