mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
safety belts.
This commit is contained in:
@@ -153,6 +153,12 @@ Accounts._getAccountData = function (connectionId, field) {
|
||||
|
||||
Accounts._setAccountData = function (connectionId, field, value) {
|
||||
var data = accountData[connectionId];
|
||||
|
||||
// safety belt. shouldn't happen. accountData is set in onConnection,
|
||||
// we don't have a connectionId until it is set.
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
if (value === undefined)
|
||||
delete data[field];
|
||||
else
|
||||
@@ -215,10 +221,13 @@ Accounts._setLoginToken = function (connectionId, newToken) {
|
||||
var closeConnectionsForTokens = function (tokens) {
|
||||
_.each(tokens, function (token) {
|
||||
if (_.has(connectionsByLoginToken, token)) {
|
||||
_.each(connectionsByLoginToken[token], function (connectionId) {
|
||||
var connection = Accounts._getAccountData(connectionId, 'connection');
|
||||
if (connection)
|
||||
connection.close();
|
||||
// safety belt. close should defer potentially yielding callbacks.
|
||||
Meteor._noYieldsAllowed(function () {
|
||||
_.each(connectionsByLoginToken[token], function (connectionId) {
|
||||
var connection = Accounts._getAccountData(connectionId, 'connection');
|
||||
if (connection)
|
||||
connection.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user