Skip to content

Commit 86b7fb2

Browse files
committed
Merge branch 'master' of github.com:kiwiirc/irc-framework
2 parents 24be97d + d88a7ef commit 86b7fb2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/client.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ module.exports = class IrcClient extends EventEmitter {
110110
// This prevents stale state if a connection gets closed during CAP negotiation
111111
client.network.cap.negotiating = false;
112112
client.network.cap.requested = [];
113+
114+
client.command_handler.resetCache();
113115
});
114116

115117
// IRC command routing

src/commands/handler.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module.exports = class IrcCommandHandler extends EventEmitter {
2222

2323
this.request_extra_caps = [];
2424

25+
this.resetCache();
26+
2527
require('./handlers/registration')(this);
2628
require('./handlers/channel')(this);
2729
require('./handlers/user')(this);
@@ -162,10 +164,7 @@ module.exports = class IrcCommandHandler extends EventEmitter {
162164
* cache.destroy();
163165
*/
164166
cache(id) {
165-
var cache;
166-
167-
this._caches = this._caches || Object.create(null);
168-
cache = this._caches[id];
167+
let cache = this._caches[id];
169168

170169
if (!cache) {
171170
let destroyCacheFn = (cache, id) => {
@@ -189,4 +188,8 @@ module.exports = class IrcCommandHandler extends EventEmitter {
189188
hasCache(id) {
190189
return this._caches && Object.prototype.hasOwnProperty.call(this._caches, id);
191190
}
191+
192+
resetCache() {
193+
this._caches = Object.create(null);
194+
}
192195
};

0 commit comments

Comments
 (0)