core/transports: updatePresets() is now called via event emitter

This commit is contained in:
Micooz 2018-01-20 20:52:19 +08:00
parent 13465b7e60
commit a472e86ff8
2 changed files with 4 additions and 3 deletions

@ -100,11 +100,11 @@ export class Relay extends EventEmitter {
this._outbound = new Outbound({remoteInfo, pipe: this._pipe, dnsCache: new DNSCache({expire: __DNS_EXPIRE__})});
this._outbound.setInbound(this._inbound);
this._outbound.on('close', () => this.onBoundClose(this._outbound, this._inbound));
this._outbound.on('updatePresets', this.updatePresets);
// inbound
this._inbound.setOutbound(this._outbound);
this._inbound.on('close', () => this.onBoundClose(this._inbound, this._outbound));
// inject methods
this.injectMethodsToBounds({updatePresets: this.updatePresets});
this._inbound.on('updatePresets', this.updatePresets);
}
init({proxyRequest}) {

@ -1,6 +1,7 @@
/* eslint-disable no-unused-vars */
import EventEmitter from 'events';
// .on('updatePresets')
class Bound extends EventEmitter {
_remoteInfo = null;
@ -43,7 +44,7 @@ class Bound extends EventEmitter {
}
updatePresets(value) {
this.emit('updatePresets', value);
}
}