* Initiate server connect
()
| 231 | * Initiate server connect |
| 232 | */ |
| 233 | connect(): void { |
| 234 | if (this.s.state !== STATE_CLOSED) { |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | stateTransition(this, STATE_CONNECTING); |
| 239 | |
| 240 | // If in load balancer mode we automatically set the server to |
| 241 | // a load balancer. It never transitions out of this state and |
| 242 | // has no monitor. |
| 243 | if (!this.loadBalanced) { |
| 244 | this.monitor?.connect(); |
| 245 | } else { |
| 246 | stateTransition(this, STATE_CONNECTED); |
| 247 | this.emit(Server.CONNECT, this); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | closeCheckedOutConnections() { |
| 252 | return this.pool.closeCheckedOutConnections(); |