mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Be even more defensive to socket.io weirdness.
This commit is contained in:
@@ -99,13 +99,6 @@ if (typeof Sky === "undefined") Sky = {};
|
||||
status_changed();
|
||||
|
||||
|
||||
};
|
||||
var disconnected = function () {
|
||||
if (connection_timer) {
|
||||
clearTimeout(connection_timer);
|
||||
connection_timer = undefined;
|
||||
}
|
||||
retry_later(); // sets status. no need to do it here.
|
||||
};
|
||||
var cleanup_socket = function () {
|
||||
if (socket) {
|
||||
@@ -115,6 +108,14 @@ if (typeof Sky === "undefined") Sky = {};
|
||||
socket.disconnect();
|
||||
}
|
||||
};
|
||||
var disconnected = function () {
|
||||
if (connection_timer) {
|
||||
clearTimeout(connection_timer);
|
||||
connection_timer = undefined;
|
||||
}
|
||||
cleanup_socket();
|
||||
retry_later(); // sets status. no need to do it here.
|
||||
};
|
||||
var fake_connect_failed = function () {
|
||||
// sometimes socket.io just doesn't tell us when it failed. we
|
||||
// detect this with a timer and force failure.
|
||||
@@ -134,6 +135,7 @@ if (typeof Sky === "undefined") Sky = {};
|
||||
};
|
||||
var retry_later = function () {
|
||||
var timeout = retry_timeout(status.retry_count)
|
||||
if (retry_timer) { clearTimeout(retry_timer); }
|
||||
retry_timer = setTimeout(retry_now, timeout);
|
||||
|
||||
status.status = "waiting"
|
||||
@@ -152,7 +154,7 @@ if (typeof Sky === "undefined") Sky = {};
|
||||
};
|
||||
|
||||
var launch_connection = function () {
|
||||
cleanup_socket(); // cleanup the old socket.
|
||||
cleanup_socket(); // cleanup the old socket, if there was one.
|
||||
|
||||
socket = io.connect('/', { reconnect: false,
|
||||
'connect timeout': CONNECT_TIMEOUT,
|
||||
|
||||
Reference in New Issue
Block a user