diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json index 3e9f717..78c57ea 100644 --- a/__tests__/tsconfig.json +++ b/__tests__/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "../tsconfig.esm.json", "compilerOptions": { "noEmit": true, "typeRoots": ["../node_modules/@types", "../@types"] diff --git a/src/client/connection.ts b/src/client/connection.ts index dfe63fa..654d776 100644 --- a/src/client/connection.ts +++ b/src/client/connection.ts @@ -334,7 +334,7 @@ export class Connection extends EventEmitter implements IConnection { }) socket.on('close', () => { - if (this._readyState === ReadyState.CLOSING) { + if (this._readyState === ReadyState.CLOSING || !this._connectionTimer) { this._readyState = ReadyState.CLOSED } else { connectionError = (connectionError != null) ? connectionError : new HL7FatalError('Socket closed unexpectedly by server.')