Bug 888058 - SimplePush: catch ping exception. r=dougt

This commit is contained in:
Nikhil Marathe 2013-07-04 09:25:05 -07:00
Родитель 851bd9c42b
Коммит b6cccf566f
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -678,8 +678,15 @@ this.PushService = {
else if (this._currentState == STATE_READY) {
// Send a ping.
// Bypass the queue; we don't want this to be kept pending.
this._ws.sendMsg('{}');
debug("Sent ping.");
// Watch out for exception in case the socket has disconnected.
// When this happens, we pretend the ping was sent and don't specially
// handle the exception, as the lack of a pong will lead to the socket
// being reset.
try {
this._ws.sendMsg('{}');
} catch (e) {
}
this._waitingForPong = true;
this._setAlarm(prefs.get("requestTimeout"));
}