Comparing version 2.9.1 to 2.9.2
@@ -150,3 +150,5 @@ "use strict"; | ||
if (!this.isClosed()) { | ||
yield this.disconnected(this.transport.closeError); | ||
// if the transport gave an error use that, otherwise | ||
// we may have received a protocol error | ||
yield this.disconnected(this.transport.closeError || this.lastError); | ||
return; | ||
@@ -268,2 +270,8 @@ } | ||
while (true) { | ||
if (this._closed) { | ||
// if we are disconnected, and close is called, the client | ||
// still tries to reconnect - to match the reconnect policy | ||
// in the case of close, want to stop. | ||
this.servers.clear(); | ||
} | ||
const wait = this.options.reconnectDelayHandler | ||
@@ -366,15 +374,17 @@ ? this.options.reconnectDelayHandler() | ||
const err = ProtocolHandler.toError(s); | ||
let isMuxPermissionError = false; | ||
const status = { type: types_1.Events.Error, data: err.code }; | ||
if (err.permissionContext) { | ||
status.permissionContext = err.permissionContext; | ||
const mux = this.subscriptions.getMux(); | ||
isMuxPermissionError = (mux === null || mux === void 0 ? void 0 : mux.subject) === err.permissionContext.subject; | ||
if (err.isPermissionError()) { | ||
let isMuxPermissionError = false; | ||
if (err.permissionContext) { | ||
status.permissionContext = err.permissionContext; | ||
const mux = this.subscriptions.getMux(); | ||
isMuxPermissionError = (mux === null || mux === void 0 ? void 0 : mux.subject) === err.permissionContext.subject; | ||
} | ||
this.subscriptions.handleError(err); | ||
this.muxSubscriptions.handleError(isMuxPermissionError, err); | ||
if (isMuxPermissionError) { | ||
// remove the permission - enable it to be recreated | ||
this.subscriptions.setMux(null); | ||
} | ||
} | ||
this.subscriptions.handleError(err); | ||
this.muxSubscriptions.handleError(isMuxPermissionError, err); | ||
if (isMuxPermissionError) { | ||
// remove the permission - enable it to be recreated | ||
this.subscriptions.setMux(null); | ||
} | ||
this.dispatchStatus(status); | ||
@@ -390,3 +400,3 @@ yield this.handleError(err); | ||
if (err.isProtocolError()) { | ||
yield this._close(err); | ||
this.lastError = err; | ||
} | ||
@@ -393,0 +403,0 @@ if (!err.isPermissionError()) { |
@@ -96,2 +96,6 @@ "use strict"; | ||
} | ||
// fn could have also set an error | ||
if (this.err) { | ||
throw this.err; | ||
} | ||
continue; | ||
@@ -98,0 +102,0 @@ } |
@@ -42,2 +42,3 @@ import { DnsResolveFn, Server, ServerInfo, ServersChanged } from "./types"; | ||
}>); | ||
clear(): void; | ||
updateTLSName(): void; | ||
@@ -44,0 +45,0 @@ getCurrentServer(): ServerImpl; |
@@ -166,2 +166,5 @@ "use strict"; | ||
} | ||
clear() { | ||
this.servers.length = 0; | ||
} | ||
updateTLSName() { | ||
@@ -168,0 +171,0 @@ const cs = this.getCurrentServer(); |
@@ -46,3 +46,3 @@ "use strict"; | ||
const dns = require("dns"); | ||
const VERSION = "2.9.1"; | ||
const VERSION = "2.9.2"; | ||
const LANG = "nats.js"; | ||
@@ -49,0 +49,0 @@ class NodeTransport { |
{ | ||
"name": "nats", | ||
"version": "2.9.1", | ||
"version": "2.9.2", | ||
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"clean": "shx rm -Rf ./lib/* ./nats-base-client ./.deps", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.9.2 https://github.com/nats-io/nats.deno.git", | ||
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.9.3 https://github.com/nats-io/nats.deno.git", | ||
"fmt": "deno fmt ./src/ ./examples/ ./test/", | ||
@@ -46,0 +46,0 @@ "prepack": "npm run clone-nbc && npm run cjs && npm run check-package && npm run build", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
879567
15110