Prevent multiple attaches on socket close for the same user
This commit is contained in:
parent
b0f2abad8b
commit
6919498234
@ -9,7 +9,7 @@ import { extractCredentials } from '/imports/api/common/server/helpers';
|
|||||||
|
|
||||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||||
|
|
||||||
function currentUser() {
|
function currentUser(registerCallback) {
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
return Users.find({ meetingId: '' });
|
return Users.find({ meetingId: '' });
|
||||||
}
|
}
|
||||||
@ -27,7 +27,9 @@ function currentUser() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._session.socket.on('close', _.debounce(onCloseConnection, 100));
|
if (registerCallback) {
|
||||||
|
this._session.socket.on('close', _.debounce(onCloseConnection, 100));
|
||||||
|
}
|
||||||
|
|
||||||
const selector = {
|
const selector = {
|
||||||
meetingId,
|
meetingId,
|
||||||
|
@ -229,9 +229,11 @@ class Auth {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let registerCallback = true;
|
||||||
|
|
||||||
Tracker.autorun((c) => {
|
Tracker.autorun((c) => {
|
||||||
computation = c;
|
computation = c;
|
||||||
Meteor.subscribe('current-user');
|
Meteor.subscribe('current-user', registerCallback);
|
||||||
|
|
||||||
const selector = { meetingId: this.meetingID, userId: this.userID };
|
const selector = { meetingId: this.meetingID, userId: this.userID };
|
||||||
const fields = {
|
const fields = {
|
||||||
@ -242,7 +244,7 @@ class Auth {
|
|||||||
if (!User || !('intId' in User)) {
|
if (!User || !('intId' in User)) {
|
||||||
logger.info({ logCode: 'auth_service_resend_validateauthtoken' }, 're-send validateAuthToken for delayed authentication');
|
logger.info({ logCode: 'auth_service_resend_validateauthtoken' }, 're-send validateAuthToken for delayed authentication');
|
||||||
makeCall('validateAuthToken', this.meetingID, this.userID, this.token);
|
makeCall('validateAuthToken', this.meetingID, this.userID, this.token);
|
||||||
|
registerCallback = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user