Better handling of online/offline behavior, socket shutdown (#1593)

* Online/offline: Always stop timer, don't connect if closed

* Sockets: Send our own close event faster, shutdown only on close

Seems that we were too-aggressively disconnecting from all socket
events. Also, we should be able to send our own close event a lot
faster with no ill effects.

* Catch-up libtextsecure changes
This commit is contained in:
Scott Nonnenberg 2017-10-23 14:38:43 -07:00 committed by GitHub
parent 3b810d3196
commit 6a895f0e27
4 changed files with 14 additions and 6 deletions

View file

@ -28,6 +28,10 @@ MessageReceiver.prototype = new textsecure.EventTarget();
MessageReceiver.prototype.extend({
constructor: MessageReceiver,
connect: function() {
if (this.calledClose) {
return;
}
this.hasConnected = true;
if (this.socket && this.socket.readyState !== WebSocket.CLOSED) {
@ -78,8 +82,6 @@ MessageReceiver.prototype.extend({
this.wsr.close(3000, 'called close');
}
this.shutdown();
return this.drain();
},
onopen: function() {