[Pkg-javascript-commits] [sockjs-client] 323/434: Set an 8 second timeout for xhr info requests.
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:22 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 9b1eabd0e14c3b6e69c1ac925f5a855c96aefdb3
Author: Marek Majkowski <majek04 at gmail.com>
Date: Wed Jan 18 13:08:53 2012 +0000
Set an 8 second timeout for xhr info requests.
---
lib/info.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/info.js b/lib/info.js
index b76b27a..6ed950e 100644
--- a/lib/info.js
+++ b/lib/info.js
@@ -9,7 +9,13 @@ InfoReceiver.prototype.doXhr = function(base_url, AjaxObject) {
var that = this;
var t0 = (new Date()).getTime();
var xo = new AjaxObject('GET', base_url + '/info' , null);
+
+ var tref = utils.delay(8000,
+ function(){xo.ontimeout();});
+
xo.onfinish = function(status, text) {
+ clearTimeout(tref);
+ tref = null;
if (status === 200) {
var rtt = (new Date()).getTime() - t0;
var info = JSON.parse(text);
@@ -19,6 +25,10 @@ InfoReceiver.prototype.doXhr = function(base_url, AjaxObject) {
that.emit('finish');
}
};
+ xo.ontimeout = function() {
+ xo.close();
+ that.emit('finish');
+ };
};
var InfoReceiverIframe = function(base_url) {
--
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