Permalink
Browse files

#2739

  • Loading branch information...
1 parent 15ec0a0 commit 98aeb6b961c8c68af2eed42ead9774307aaea129 @abnanda1 abnanda1 committed Jan 2, 2014
@@ -95,19 +95,6 @@
return connection.state === signalR.connectionState.disconnected;
},
- configurePingInterval = function (connection) {
- var config = connection._.config,
- onFail = function (error) {
- $(connection).triggerHandler(events.onError, [error]);
- };
-
- if (!config.pingIntervalId && config.pingInterval) {
- connection._.pingIntervalId = window.setInterval(function () {
- signalR.transports._logic.pingServer(connection).fail(onFail);
- }, config.pingInterval);
- }
- },
-
configureStopReconnectingTimeout = function (connection) {
var stopReconnectingTimeout,
onReconnectTimeout;
@@ -209,6 +196,19 @@
return 0;
}
return parseInt(matches[1], 10 /* radix */);
+ },
+
+ configurePingInterval: function (connection) {
+ var config = connection._.config,
+ onFail = function (error) {
+ $(connection).triggerHandler(events.onError, [error]);
+ };
+
+ if (!connection._.pingIntervalId && config.pingInterval) {
+ connection._.pingIntervalId = window.setInterval(function () {
+ signalR.transports._logic.pingServer(connection).fail(onFail);
+ }, config.pingInterval);
+ }
}
};
@@ -595,7 +595,7 @@
// Used to ensure low activity clients maintain their authentication.
// Must be configured once a transport has been decided to perform valid ping requests.
- configurePingInterval(connection);
+ signalR._.configurePingInterval(connection);
changeState(connection,
signalR.connectionState.connecting,
@@ -942,6 +942,7 @@
delete connection.id;
delete connection._.pingIntervalId;
delete connection._.lastMessageAt;
+ delete connection._.lastActiveAt;
// Clear out our message buffer
connection._.connectingMessageBuffer.clear();
@@ -87,4 +87,14 @@ QUnit.test("connection.withCredentials manual override to false for cross-domain
con.start({ withCredentials: false });
QUnit.ok(!con.withCredentials, "connection.withCredentials overridden to false for cross-domain connection.");
+});
+
+QUnit.test("pingIntervalId does not change on multiple calls to configurePingInterval", function () {
+ var con = testUtilities.createConnection("/signalr", function () { }, QUnit, "", false);
+
+ con._.pingIntervalId = 1;
+
+ $.signalR._.configurePingInterval(con);
+
+ QUnit.equal(con._.pingIntervalId, 1);
});

0 comments on commit 98aeb6b

Please sign in to comment.