(cb)
| 240 | } |
| 241 | |
| 242 | doClose(cb) { |
| 243 | this[kPendingClose] = true; |
| 244 | |
| 245 | const handle = this._handle; |
| 246 | |
| 247 | // When sockets of the "net" module destroyed, they will call |
| 248 | // `this._handle.close()` which will also emit EOF if not emitted before. |
| 249 | // This feature makes sockets on the other side emit "end" and "close" |
| 250 | // even though we haven't called `end()`. As `stream` are likely to be |
| 251 | // instances of `net.Socket`, calling `stream.destroy()` manually will |
| 252 | // avoid issues that don't properly close wrapped connections. |
| 253 | this.stream.destroy(); |
| 254 | |
| 255 | setImmediate(() => { |
| 256 | // Should be already set by net.js |
| 257 | assert(this._handle === null); |
| 258 | |
| 259 | this.finishWrite(handle, uv.UV_ECANCELED); |
| 260 | this.finishShutdown(handle, uv.UV_ECANCELED); |
| 261 | |
| 262 | this[kPendingClose] = false; |
| 263 | |
| 264 | cb(); |
| 265 | }); |
| 266 | } |
| 267 | |
| 268 | get [kBoundSession]() { |
| 269 | return this.stream[kBoundSession]; |
no test coverage detected