myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject [myfaces] branch master updated: MYFACES-4240: Fixing an issue with null in reconnectAttempts.
Date Tue, 19 Jun 2018 11:17:57 GMT
This is an automated email from the ASF dual-hosted git repository.

werpu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a495c5  MYFACES-4240: Fixing an issue with null in reconnectAttempts.
3a495c5 is described below

commit 3a495c500453b6d8b20f3b7432bf499a8b672dd3
Author: Werner Punz <werner.punz@gmail.com>
AuthorDate: Tue Jun 19 13:15:20 2018 +0200

    MYFACES-4240: Fixing an issue with
    null in reconnectAttempts.
---
 .../main/javascript/META-INF/resources/myfaces/api/jsf.js  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js b/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js
index 7fed7a3..8eceb1f 100644
--- a/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js
+++ b/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js
@@ -265,7 +265,7 @@ if (!jsf.push) {
         // Private fields -----------------------------------------------------------------------------------------
 
         var socket;
-        var reconnectAttempts;
+        var reconnectAttempts = 0;
         var self = this;
 
         // Public functions ---------------------------------------------------------------------------------------
@@ -281,7 +281,7 @@ if (!jsf.push) {
             socket = new WebSocket(url);
 
             socket.onopen = function(event) {
-                if (reconnectAttempts == null) {
+                if (!reconnectAttempts) {
                     var clientIds = clientIdsByTokens[channelToken];
                     for (var i = clientIds.length - 1; i >= 0; i--){
                         var socketClientId = clientIds[i];
@@ -289,7 +289,7 @@ if (!jsf.push) {
                     }
                 }
                 reconnectAttempts = 0;
-            }
+            };
 
             socket.onmessage = function(event) {
                 var message = JSON.parse(event.data);
@@ -321,13 +321,13 @@ if (!jsf.push) {
                     self.close();
                 }
 
-            }
+            };
 
             socket.onclose = function(event) {
                 if (!socket
                     || (event.code == 1000 && event.reason == REASON_EXPIRED)
                     || (event.code == 1008)
-                    || (reconnectAttempts == null)
+                    || (!reconnectAttempts)
                     || (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS))
                 {
                     var clientIds = clientIdsByTokens[channelToken];
@@ -339,8 +339,8 @@ if (!jsf.push) {
                 else {
                     setTimeout(self.open, RECONNECT_INTERVAL * reconnectAttempts++);
                 }
-            }
-        }
+            };
+        };
 
         /**
          * Closes the reconnecting web socket.


Mime
View raw message