handle connection errors
When running Bitmask Android in obfs+KCP mode using the demo provider we occasionally (while testing with my device once or twice per hour) get errors which break the connectivity and Bitmask is not yet able to recover from that state on its own.
I can see a bunch of these messages sent via the event logger:
Write err from 0.0.0.0:38939 to 37.217.245.94:4431: write udp
0.0.0.0:38939: sendmsg: network is unreachable
it also might be related to Android getting into a Doze mode.
I can see in the logs that openvpn tries to reconnect, but fails afterwards. Manually stopping and restarting resolves the situation.
I wonder if this issue also appears on Desktop from time to time.
Also we should try to figure out if obfsvpn could try to re-connect itself. Alternatively an API to reconnect obfsvpn could be another option. In that case Bitmask could force an reconnect whenever it detects that openvpn tries to reconnect, which already has this kind of recovery mechanism.
As a quick fix I will always try to start and stop obfsvpn whenever obfsvpn sends the error event and openvpn tries to reconnect.
part of QA during RC testing: bitmask_android#9186 (closed)