mirror of
https://github.com/reality/dbot.git
synced 2025-01-25 19:44:22 +01:00
fix another potential race condition
This commit is contained in:
parent
024ee7913e
commit
24aaf298f7
@ -40,12 +40,13 @@ var atheme = function(dbot) {
|
|||||||
} else {
|
} else {
|
||||||
this.hostStack[server][mask] = {
|
this.hostStack[server][mask] = {
|
||||||
'users': [],
|
'users': [],
|
||||||
'callbacks': [ callback ]
|
'callbacks': [ callback ],
|
||||||
|
'timeout': null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
dbot.say(server, 'hostserv', 'LISTVHOST ' + mask);
|
dbot.say(server, 'hostserv', 'LISTVHOST ' + mask);
|
||||||
setTimeout(function() { // Delete callback if no response
|
this.hostStack[server][mask].timeout = setTimeout(function() { // Delete callback if no response
|
||||||
if(_.has(this.hostStack[server], mask)) {
|
if(_.has(this.hostStack[server], mask)) {
|
||||||
_.each(this.hostStack[server][mask].callbacks, function(callback) {
|
_.each(this.hostStack[server][mask].callbacks, function(callback) {
|
||||||
callback(true, null);
|
callback(true, null);
|
||||||
@ -124,6 +125,7 @@ var atheme = function(dbot) {
|
|||||||
_.each(this.hostStack[event.server][mask].callbacks, function(callback) {
|
_.each(this.hostStack[event.server][mask].callbacks, function(callback) {
|
||||||
callback(null, this.hostStack[event.server][mask].users);
|
callback(null, this.hostStack[event.server][mask].users);
|
||||||
}, this);
|
}, this);
|
||||||
|
clearTimeout(this.hostStack[event.server][mask].timeout);
|
||||||
delete this.hostStack[event.server][mask];
|
delete this.hostStack[event.server][mask];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user