(stream: Stream, options: ConnectionOptions)
| 231 | static readonly UNPINNED = UNPINNED; |
| 232 | |
| 233 | constructor(stream: Stream, options: ConnectionOptions) { |
| 234 | super(); |
| 235 | this.on('error', noop); |
| 236 | |
| 237 | this.socket = stream; |
| 238 | this.id = options.id; |
| 239 | this.address = streamIdentifier(stream, options); |
| 240 | this.socketTimeoutMS = options.socketTimeoutMS ?? 0; |
| 241 | this.monitorCommands = options.monitorCommands; |
| 242 | this.serverApi = options.serverApi; |
| 243 | this.mongoLogger = options.mongoLogger; |
| 244 | this.established = false; |
| 245 | |
| 246 | this.description = new StreamDescription(this.address, options); |
| 247 | this.generation = options.generation; |
| 248 | this.lastUseTime = processTimeMS(); |
| 249 | |
| 250 | this.messageStream = this.socket |
| 251 | .on('error', this.onSocketError.bind(this)) |
| 252 | .pipe(new SizedMessageTransform({ connection: this })) |
| 253 | .on('error', this.onTransformError.bind(this)); |
| 254 | this.socket.on('close', this.onClose.bind(this)); |
| 255 | this.socket.on('timeout', this.onTimeout.bind(this)); |
| 256 | |
| 257 | this.messageStream.pause(); |
| 258 | } |
| 259 | |
| 260 | public get hello() { |
| 261 | return this.description.hello; |
nothing calls this directly
no test coverage detected