close socket from failed connect.

fixes https://github.com/nbd-wtf/nostr-tools/issues/550
This commit is contained in:
fiatjaf
2026-09-04 01:20:52 -03:00
parent a8fc3499e4
commit e1a62b911f
3 changed files with 4 additions and 2 deletions
+2
View File
@@ -180,6 +180,7 @@ export class AbstractRelay {
if (this.reconnectAttempts === 0) { if (this.reconnectAttempts === 0) {
this.skipReconnection = true this.skipReconnection = true
} }
this.ws?.close?.()
this.handleHardClose('relay connection timed out') this.handleHardClose('relay connection timed out')
}, opts.timeout) }, opts.timeout)
} }
@@ -236,6 +237,7 @@ export class AbstractRelay {
if (this.reconnectAttempts === 0) { if (this.reconnectAttempts === 0) {
this.skipReconnection = true this.skipReconnection = true
} }
this.ws?.close?.()
this.handleHardClose('relay connection failed') this.handleHardClose('relay connection failed')
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@nostr/tools", "name": "@nostr/tools",
"version": "2.25.1", "version": "2.25.2",
"exports": { "exports": {
".": "./index.ts", ".": "./index.ts",
"./core": "./core.ts", "./core": "./core.ts",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"type": "module", "type": "module",
"name": "nostr-tools", "name": "nostr-tools",
"version": "2.25.1", "version": "2.25.2",
"description": "Tools for making a Nostr client.", "description": "Tools for making a Nostr client.",
"repository": { "repository": {
"type": "git", "type": "git",