relaycorp / awala-ping-android

Android app for the Awala Ping Service
GNU General Public License v3.0
0 stars 0 forks source link

Determine how to handle the case when the gateway is upgraded whilst we're using it #29

Closed gnarea closed 2 years ago

gnarea commented 3 years ago

Because right now it's crashing due to https://github.com/relaycorp/awala-endpoint-android/issues/75.

One way to handle it is by catching the appropriate exception in the statement below, and re-doing the binding to the gateway.

https://github.com/relaycorp/awala-ping-android/blob/e4e5d87eec6b953989f117d9d67e5c64404ef1df/app/src/main/java/tech/relaycorp/ping/App.kt#L45

Alternatively, we could do something in awaladroid that won't require changes to this app. But is there anything reliable that we can do?

sdsantos commented 2 years ago

I wasn't able to reproduce the issue. The only place that exception is thrown is from inside Awaladroid ReceiveMessages#collectParcels and we're already handling ServerException there, a superclass of ServerConnectionException of the crash log. And, that scenario is covered by a test.

We only collect parcels when we're notified on the ping app. And this call should be safe GatewayClient.receiveMessages().collect(receivePong::receive) since that only subscribes to a stream of parcels that we receive, but it's not the stream collecting the parcels. Since it's disconnected from the stuff that might fail when connecting with the Gateway, developers won't need to re-subscribe to it.