()
| 94 | } |
| 95 | |
| 96 | private disposeClient() { |
| 97 | try { |
| 98 | if (this.connected) { |
| 99 | this.connected = false; |
| 100 | this.emit('disconnected'); |
| 101 | } |
| 102 | if (this.client) { |
| 103 | const saved = this.client; |
| 104 | this.client = null; |
| 105 | saved.destroy(); |
| 106 | } |
| 107 | } |
| 108 | catch (e) { |
| 109 | // For debug only |
| 110 | console.log(`Socked destroy error ${e}`); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | public dispose() { |
| 115 | if (this.timer) { |