From b047930d76a4f011cd9961ea34bff7652629d7a4 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 8 Jul 2020 09:50:57 -0700 Subject: [PATCH] quic: proper custom inspect for QuicSocket PR-URL: https://github.com/nodejs/node/pull/34247 Reviewed-By: Anna Henningsen --- lib/internal/quic/core.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index 0b0629d37745e0..2c3ab4b888ef41 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -977,14 +977,18 @@ class QuicSocket extends EventEmitter { } } - [kInspect]() { - // TODO(@jasnell): Proper custom inspect implementation - const state = this[kInternalState]; - const obj = { + [kInspect](depth, options) { + return customInspect(this, { endpoints: this.endpoints, - sessions: state.sessions, - }; - return `QuicSocket ${util.format(obj)}`; + sessions: this.sessions, + bound: this.bound, + pending: this.pending, + closing: this.closing, + destroyed: this.destroyed, + listening: this.listening, + serverBusy: this.serverBusy, + statelessResetDisabled: this.statelessResetDisabled, + }, depth, options); } [kAddSession](session) {