()
| 332 | } |
| 333 | |
| 334 | public destroy(): void { |
| 335 | if (this.closed) { |
| 336 | return; |
| 337 | } |
| 338 | |
| 339 | // load balanced mode requires that these listeners remain on the connection |
| 340 | // after cleanup on timeouts, errors or close so we remove them before calling |
| 341 | // cleanup. |
| 342 | this.removeAllListeners(Connection.PINNED); |
| 343 | this.removeAllListeners(Connection.UNPINNED); |
| 344 | const message = `connection ${this.id} to ${this.address} closed`; |
| 345 | this.cleanup(new MongoNetworkError(message)); |
| 346 | } |
| 347 | |
| 348 | /** |
| 349 | * A method that cleans up the connection. When `force` is true, this method |
no test coverage detected