[Pkg-javascript-commits] [sockjs-client] 272/434: #36 delay shall be called RTO

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit aea387d046b688a1580ec7d6904fb10ae379379b
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Mon Jan 9 17:45:42 2012 +0000

    #36 delay shall be called RTO
---
 lib/sockjs.js |  6 +++---
 lib/utils.js  | 14 +++++++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/sockjs.js b/lib/sockjs.js
index ef02ca3..1181c1d 100644
--- a/lib/sockjs.js
+++ b/lib/sockjs.js
@@ -107,7 +107,7 @@ SockJS.prototype._didClose = function(code, reason) {
                         that._didClose(2007,
                                        "Transport timeouted");
                     }
-                }, that._options.delay || 5000);
+                }, that._options.rto || 5000);
 
             return;
         }
@@ -182,7 +182,7 @@ SockJS.prototype._try_next_protocol = function(close_event) {
             var connid = utils.random_string(8);
             var trans_url = that._base_url + '/' + that._server + '/' + connid;
             that._debug('Opening transport:', protocol, ' url:'+trans_url,
-                        ' delay:'+that._options.delay);
+                        ' RTO:'+that._options.rto);
             that._transport = new SockJS[protocol](that, trans_url,
                                                    that._base_url);
             return true;
@@ -216,5 +216,5 @@ SockJS.prototype.send = function(data) {
 SockJS.prototype._applyInfo = function(data) {
     var that = this;
     that._options.info = data.info;
-    that._options.delay = utils.countDelay(data.rtt);
+    that._options.rto = utils.countRTO(data.rtt);
 };
diff --git a/lib/utils.js b/lib/utils.js
index 8880ae7..5bf9b98 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -49,12 +49,16 @@ utils.userSetCode = function (code) {
     return code === 1000 || (code >= 3000 && code <= 4999);
 };
 
-utils.countDelay = function (rtt) {
-    var rtt5 = 5 * rtt;
-    if (rtt5 < 200) {
-        return 200;
+// See: http://www.erg.abdn.ac.uk/~gerrit/dccp/notes/ccid2/rto_estimator/
+// and RFC 2988.
+utils.countRTO = function (rtt) {
+    var rto;
+    if (rtt > 100) {
+        rto = 3 * rtt; // rto > 300msec
+    } else {
+        rto = rtt + 200; // 200msec < rto <= 300msec
     }
-    return rtt5;
+    return rto;
 }
 
 utils.log = function() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list