Skip to content

Commit 15c1de3

Browse files
committed
chore(nodejs): log when connection to server is closed
1 parent 2828a0f commit 15c1de3

File tree

8 files changed

+13
-17
lines changed

8 files changed

+13
-17
lines changed

docs/Sender.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ <h4 class="name" id="close"><span class="type-signature">(async) </span>close<sp
682682

683683
<dt class="tag-source">Source:</dt>
684684
<dd class="tag-source"><ul class="dummy"><li>
685-
<a href="src_sender.js.html">src/sender.js</a>, <a href="src_sender.js.html#line149">line 149</a>
685+
<a href="src_sender.js.html">src/sender.js</a>, <a href="src_sender.js.html#line146">line 146</a>
686686
</li></ul></dd>
687687

688688

@@ -2359,7 +2359,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@q
23592359
<br class="clear">
23602360

23612361
<footer>
2362-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:08:10 GMT+0100 (British Summer Time)
2362+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:44:43 GMT+0100 (British Summer Time)
23632363
</footer>
23642364

23652365
<script> prettyPrint(); </script>

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@q
176176
<br class="clear">
177177

178178
<footer>
179-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:08:10 GMT+0100 (British Summer Time)
179+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:44:43 GMT+0100 (British Summer Time)
180180
</footer>
181181

182182
<script> prettyPrint(); </script>

docs/index.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@q
5353
<br class="clear">
5454

5555
<footer>
56-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:08:10 GMT+0100 (British Summer Time)
56+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:44:43 GMT+0100 (British Summer Time)
5757
</footer>
5858

5959
<script> prettyPrint(); </script>

docs/module-@questdb_nodejs-client.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@q
156156
<br class="clear">
157157

158158
<footer>
159-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:08:10 GMT+0100 (British Summer Time)
159+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:44:43 GMT+0100 (British Summer Time)
160160
</footer>
161161

162162
<script> prettyPrint(); </script>

docs/src_sender.js.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ <h1 class="page-title">Source: src/sender.js</h1>
161161
resolve(true);
162162
}
163163
})
164-
.on("close", () => {
165-
//console.info(`Connection to ${options.host}:${options.port} is closed`);
166-
})
167164
.on("error", err => {
168165
console.error(err);
169166
});
@@ -176,7 +173,10 @@ <h1 class="page-title">Source: src/sender.js</h1>
176173
*/
177174
async close() {
178175
return new Promise(resolve => {
176+
const address = this.socket.remoteAddress;
177+
const port = this.socket.remotePort;
179178
this.socket.destroy();
179+
console.info(`Connection to ${address}:${port} is closed`);
180180
resolve();
181181
});
182182
}
@@ -508,7 +508,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@q
508508
<br class="clear">
509509

510510
<footer>
511-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:08:10 GMT+0100 (British Summer Time)
511+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 11:44:43 GMT+0100 (British Summer Time)
512512
</footer>
513513

514514
<script> prettyPrint(); </script>

src/sender.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ class Sender {
133133
resolve(true);
134134
}
135135
})
136-
.on("close", () => {
137-
//console.info(`Connection to ${options.host}:${options.port} is closed`);
138-
})
139136
.on("error", err => {
140137
console.error(err);
141138
});
@@ -148,7 +145,10 @@ class Sender {
148145
*/
149146
async close() {
150147
return new Promise(resolve => {
148+
const address = this.socket.remoteAddress;
149+
const port = this.socket.remotePort;
151150
this.socket.destroy();
151+
console.info(`Connection to ${address}:${port} is closed`);
152152
resolve();
153153
});
154154
}

test/proxyfunctions.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ async function listen(proxy, listenPort, dataHandler, tlsOptions) {
2424
proxy.client = client;
2525

2626
client.on("data", dataHandler);
27-
28-
client.on("close", () => {
29-
//console.info("client connection closed");
30-
});
3127
}
3228

3329
proxy.server = tlsOptions

types/src/sender.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)