libsignal-service-java icon indicating copy to clipboard operation
libsignal-service-java copied to clipboard

let KeepAliveSender detect if websocket is no longer alive - fixes #6447 (non GCM)

Open rkohrt opened this issue 7 years ago • 1 comments

let KeepAliveSender detect if the websocket is no longer alive and trigger recreation of SignalServiceMessagePipe - fixes WhisperSystems/Signal-Android#6447 for non GCM devices

By not checking for the response of the keep alive message it is not detected when the device goes from mobile -> WiFi or vice versa. Thus we keep sending the keep alive message to a broken pipe over and over for no reason. While we will not get push messages from the server, because we do not have a working active connection to it. I fixed the problem by listening for 30seconds to the future (line 298) created by sending the keep alive message and if we do not get a response within these 30 seconds, the connection is killed -> WebSocketConnection.client = null -> WebSocketConnection.readRequest will throw IOException("Connection closed!") -> SignalServiceMessageReceiver.MessageRetrievalThread.run will catch it and create a new SignalServiceMessagePipe utilizing the new network and we keep subscribed for push messages :-)

rkohrt avatar Feb 04 '18 11:02 rkohrt

Any comments on this one? I don't think I am the only one that has problems with this bug.

rkohrt avatar Aug 26 '18 13:08 rkohrt