From 15b871ca86041cf85a5006c1bd8848b7594506b4 Mon Sep 17 00:00:00 2001 From: Angus ZENG Date: Fri, 24 Nov 2023 23:15:55 +0800 Subject: [PATCH] fix(project): crash when connection lost during handshake --- CHANGES.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/lib/AbstractConnection.ts | 9 ++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 94710af..e564515 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## v1.1.2 + +- fix(project): crash when connection lost during handshake. + ## v1.1.1 - fix(project): use native `Error` as the based class for exceptions. diff --git a/package-lock.json b/package-lock.json index 99ba8ae..c7e6893 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@litert/lwdfx", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@litert/lwdfx", - "version": "1.1.1", + "version": "1.1.2", "license": "Apache-2.0", "devDependencies": { "@commitlint/cli": "^17.8.1", diff --git a/package.json b/package.json index b76dc86..87009c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@litert/lwdfx", - "version": "1.1.1", + "version": "1.1.2", "description": "A TypeScript implement of light-weight data frame exchange protocol.", "main": "lib/index.js", "scripts": { diff --git a/src/lib/AbstractConnection.ts b/src/lib/AbstractConnection.ts index be1660e..41725d6 100644 --- a/src/lib/AbstractConnection.ts +++ b/src/lib/AbstractConnection.ts @@ -289,8 +289,15 @@ export abstract class AbstractConnection extends $Events.EventEmitter implements return; } - this._setupSocket(); + try { + + this._setupSocket(); + } + catch (e) { + callback(e); + return; + } callback(null, this); }); }