FIX: initSocket() without arguments
This commit is contained in:
parent
aa73cd8bb3
commit
4bbd13f3c2
@ -88,6 +88,9 @@ class TlsSocketWrapper {
|
||||
this._socket.on('timeout', () => {
|
||||
this._passOnEvent('timeout');
|
||||
});
|
||||
this._socket.on('onerror', data => {
|
||||
this._passOnEvent('onerror', data);
|
||||
});
|
||||
this._socket.on('error', data => {
|
||||
this._passOnEvent('error', data);
|
||||
});
|
||||
@ -97,6 +100,12 @@ class TlsSocketWrapper {
|
||||
this._socket.on('connect', data => {
|
||||
this._passOnEvent('connect', data);
|
||||
});
|
||||
this._socket.on('secureConnect', data => {
|
||||
this._passOnEvent('secureConnect', data);
|
||||
});
|
||||
this._socket.on('connection', data => {
|
||||
this._passOnEvent('connection', data);
|
||||
});
|
||||
}
|
||||
|
||||
_passOnEvent(event, data) {
|
||||
|
||||
@ -27,10 +27,14 @@ class Client {
|
||||
this.mp = new util.MessageParser((body, n) => {
|
||||
this.onMessage(body, n);
|
||||
});
|
||||
this._protocol = protocol; // saving defaults
|
||||
this._options = options;
|
||||
this.initSocket(protocol, options);
|
||||
}
|
||||
|
||||
initSocket(protocol, options) {
|
||||
protocol = protocol || this._protocol;
|
||||
options = options || this._options;
|
||||
switch (protocol) {
|
||||
case 'tcp':
|
||||
this.conn = new net.Socket();
|
||||
@ -75,6 +79,9 @@ class Client {
|
||||
this.conn.on('error', e => {
|
||||
this.onError(e);
|
||||
});
|
||||
this.conn.on('onerror', e => {
|
||||
this.onError(e);
|
||||
});
|
||||
this.status = 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user