Before, the call to closeAll() in McsService#connect() would trigger a SocketException (Socket closed) in McsOutputStream and/or McsInputStream. This would send a teardown message causing McsService to take the new connection down right away. In unlucky situations, this could cause small connect/teardown loops. This commit hopes to prevent those.
Change-Id: Id347d598e028bdd1ba2622cd6a5c6b07874335d6
Waiting twice the heartbeat interval since the last ACK can make us miss dead connections for more than 10min in which no push messages get received.
This change requires the ACK to come within 90 seconds of sending the heartbeat ping, otherwise the connection is considered dead which will trigger a re-connect.
We use a high timeout of 90 seconds, because in some mobile networks (like in trains) ping times of more than 60 seconds have been observed in practice.
Change-Id: I8e63843400b47e1a6d23faf180f9446bcb5e0cd8
This may cause a connection attempt, but in connect(), we'll notice that it is disabled and won't continue to connect.
Change-Id: Id5f00539a48fad16b5e5f55bd336fb8890aa1acc
Otherwise, this gets called multiple times from different places via MSG_TEARDOWN. This causes the reconnect delay to increase with each call to scheduleReconnect(), increasing the time we stay disconnected.
This commit introduces a boolean flag preventing handleTeardown() to run twice or more until connect() was called again.
Change-Id: I3d7cb08d696be48532a61819fbb279a908919a3d
Instead of directly jumping to the settings screen (which is what the
"Request background location access" amounts to) and leaving the user
there without a clue what to do, we update the label, icon and button
with new text explaining what the user needs to do next.
With time synchronisation and can happen that timestamps in database are newer
than reported system time, which then can lead to reported exposure with
multiple measurements but negative or zero reported duration, resulting in
divide-by-zero and other issues in average RSSI calculation. This fixes the
issue, by ignoring new measurements of the same RPI when they are seemingly
older than a previous measurement.
Without this it can happen that we learn the interval too close to 0 which causes us to assume that we are always disconnected breaking Mcs network functionality
Change-Id: I0dee59d1365a8e10941dd346bfcd7af19d79d523
This doesn't treat the underlying issues and can make debugging harder if we suddenly auto-connect due to this.
Change-Id: I9c04c78e8ebda8472b0cd8c7b0b0deb2e2300139