Skip to content

Commit

Permalink
[FIX] added guard to see if it fixes #560 (#564)
Browse files Browse the repository at this point in the history
* [FIX] added guard to see if it fixes  #560

* bump version
  • Loading branch information
aricart authored Mar 11, 2023
1 parent e14312f commit cb98efa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nats",
"version": "2.13.0",
"version": "2.13.1",
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system",
"keywords": [
"nats",
Expand Down
9 changes: 6 additions & 3 deletions src/node_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { resolve } = require("path");
const { readFile, existsSync } = require("fs");
const dns = require("dns");

const VERSION = "2.13.0";
const VERSION = "2.13.1";
const LANG = "nats.js";

export class NodeTransport implements Transport {
Expand Down Expand Up @@ -270,8 +270,11 @@ export class NodeTransport implements Transport {
});

this.socket.on("end", () => {
this.socket.write(new Uint8Array(0), () => {
this.socket.end();
if(this.socket?.destroyed) {
return;
}
this.socket?.write(new Uint8Array(0), () => {
this.socket?.end();
});
});

Expand Down

0 comments on commit cb98efa

Please sign in to comment.