@cosyte/mllp 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/index.cjs +51 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -5
- package/dist/index.d.ts +56 -5
- package/dist/index.mjs +51 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1615,9 +1615,18 @@ type ConnectionErrorPhase = "connect" | "send" | "receive" | "close" | "reconnec
|
|
|
1615
1615
|
* server, …). See `isTlsProtocolError` for the boundary. Pure TCP-level
|
|
1616
1616
|
* failures (`ECONNREFUSED`, `ETIMEDOUT`, …) on a TLS-configured
|
|
1617
1617
|
* connection carry **no** `connectionCause`, the same shape as plaintext.
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1620
|
-
*
|
|
1618
|
+
* - `'framing-fatal'`, the peer sent bytes the decoder could not accept, or a
|
|
1619
|
+
* frame past the size cap. Classified **permanent**.
|
|
1620
|
+
* - `'connect-timeout'`, the connection was not established within
|
|
1621
|
+
* `ClientOptions.connectTimeoutMs`: the TCP connect, or the TLS handshake
|
|
1622
|
+
* after it, did not complete in time and the socket was destroyed. Nothing
|
|
1623
|
+
* was written, so no message reached the peer. The `cause` carries
|
|
1624
|
+
* `code: 'ETIMEDOUT'`, and it is classified **transient** by
|
|
1625
|
+
* `isTransientConnectionError`, like the operating system's own connect
|
|
1626
|
+
* timeout: a peer that is down or unreachable now may answer later.
|
|
1627
|
+
*
|
|
1628
|
+
* Scope note: the `'tls-verify'`/`'tls-handshake'`/`'connect-timeout'` values
|
|
1629
|
+
* are attached on the client's **initial `connect()` path**. Failures on the auto-reconnect
|
|
1621
1630
|
* path surface as raw socket errors, their transient/permanent
|
|
1622
1631
|
* classification still applies, but they do not (yet) carry a
|
|
1623
1632
|
* `connectionCause`.
|
|
@@ -1630,7 +1639,7 @@ type ConnectionErrorPhase = "connect" | "send" | "receive" | "close" | "reconnec
|
|
|
1630
1639
|
* }
|
|
1631
1640
|
* ```
|
|
1632
1641
|
*/
|
|
1633
|
-
type ConnectionErrorCause = "fifo-unsafe" | "in-flight-orphan" | "tls-verify" | "tls-handshake" | "framing-fatal";
|
|
1642
|
+
type ConnectionErrorCause = "fifo-unsafe" | "in-flight-orphan" | "tls-verify" | "tls-handshake" | "framing-fatal" | "connect-timeout";
|
|
1634
1643
|
/**
|
|
1635
1644
|
* Thrown (or emitted via `onError`) for socket-layer problems such as
|
|
1636
1645
|
* connection refused, ECONNRESET, ETIMEDOUT, or DNS failure.
|
|
@@ -3142,6 +3151,26 @@ interface ClientOptions {
|
|
|
3142
3151
|
* @default undefined (off)
|
|
3143
3152
|
*/
|
|
3144
3153
|
readonly deadPeerTimeoutMs?: number;
|
|
3154
|
+
/**
|
|
3155
|
+
* Bound, in milliseconds, on establishing each connection: the TCP connect and, when
|
|
3156
|
+
* {@link ClientOptions.tls} is set, the TLS handshake after it. The clock starts when the
|
|
3157
|
+
* socket is created and stops at `'connect'` (plaintext) or `'secureConnect'` (TLS).
|
|
3158
|
+
*
|
|
3159
|
+
* On expiry the socket is destroyed. On `connect()` the promise rejects with an
|
|
3160
|
+
* `MllpConnectionError` whose `phase` is `'connect'` and whose `connectionCause` is
|
|
3161
|
+
* `'connect-timeout'`; nothing was written, so no message can have reached the peer. On an
|
|
3162
|
+
* auto-reconnect attempt the failure feeds the reconnect policy like any other connect
|
|
3163
|
+
* failure: `RetryContext.lastError` carries `code: 'ETIMEDOUT'` and it is classified
|
|
3164
|
+
* **transient**, so the client backs off and tries again.
|
|
3165
|
+
*
|
|
3166
|
+
* Must be an integer from 1 to 2147483647 (the largest delay a Node timer takes); anything else
|
|
3167
|
+
* throws a `RangeError` at construction. Unset means no bound of our own: a connect waits on
|
|
3168
|
+
* the operating system, and a TLS handshake against a peer that accepts the TCP connection and
|
|
3169
|
+
* never answers waits indefinitely.
|
|
3170
|
+
*
|
|
3171
|
+
* @default undefined (no bound)
|
|
3172
|
+
*/
|
|
3173
|
+
readonly connectTimeoutMs?: number;
|
|
3145
3174
|
/**
|
|
3146
3175
|
* Enable TLS (MLLPS) for this connection. `true` enables TLS with
|
|
3147
3176
|
* all defaults, including certificate verification **on**. Pass a
|
|
@@ -3381,6 +3410,9 @@ declare class MllpClient extends EventEmitter {
|
|
|
3381
3410
|
* TLS failures carry a `connectionCause`: `'tls-verify'` for certificate
|
|
3382
3411
|
* verification failures, `'tls-handshake'` for TLS-protocol-shaped failures
|
|
3383
3412
|
* ({@link isTlsProtocolError}); pure TCP failures carry none.
|
|
3413
|
+
* - `MllpConnectionError({ phase: 'connect', connectionCause: 'connect-timeout' })` if
|
|
3414
|
+
* {@link ClientOptions.connectTimeoutMs} is set and the TCP connect, or the TLS handshake
|
|
3415
|
+
* after it, did not complete in time. The socket is destroyed; nothing was written.
|
|
3384
3416
|
* - `MllpTlsConfigurationError` if the configured cipher-suite list cannot be
|
|
3385
3417
|
* honoured (the runtime rejects it, or `atnaTransportSecurity` and `ciphers`
|
|
3386
3418
|
* both declare one). Raised **before** a socket is opened, so nothing is left
|
|
@@ -3425,6 +3457,18 @@ declare class MllpClient extends EventEmitter {
|
|
|
3425
3457
|
* against it.
|
|
3426
3458
|
*/
|
|
3427
3459
|
private _createSocketAndTransport;
|
|
3460
|
+
/**
|
|
3461
|
+
* Bound one connection attempt by {@link ClientOptions.connectTimeoutMs}, when it is set.
|
|
3462
|
+
*
|
|
3463
|
+
* Armed after the `Connection` has registered its own socket listeners (its set-once
|
|
3464
|
+
* `onClose`/`onError` would otherwise remove ours). The timer stops at the socket's connect
|
|
3465
|
+
* event (`'secureConnect'` for TLS, so the handshake is inside the bound) or at its `'close'`,
|
|
3466
|
+
* whichever comes first; a refused connect or an abort therefore leaves no timer behind. On
|
|
3467
|
+
* expiry the socket is destroyed with a {@link ConnectTimeoutCause}, which reaches the same
|
|
3468
|
+
* `'error'` listeners as any other connect failure: `connect()` rejects, and a reconnect
|
|
3469
|
+
* attempt hands it to the reconnect classifier.
|
|
3470
|
+
*/
|
|
3471
|
+
private _armConnectTimeout;
|
|
3428
3472
|
/**
|
|
3429
3473
|
* Wrap a connect-phase socket error as `MllpConnectionError`, classifying
|
|
3430
3474
|
* TLS failures into the additive `connectionCause`:
|
|
@@ -3962,6 +4006,11 @@ interface StarterClientOptions {
|
|
|
3962
4006
|
readonly keepaliveIntervalMs?: number;
|
|
3963
4007
|
/** Application-idle dead-peer timeout ms. */
|
|
3964
4008
|
readonly deadPeerTimeoutMs?: number;
|
|
4009
|
+
/**
|
|
4010
|
+
* Bound on the TCP connect and TLS handshake, in ms. Passthrough to
|
|
4011
|
+
* `ClientOptions.connectTimeoutMs`; unset means no bound, as there.
|
|
4012
|
+
*/
|
|
4013
|
+
readonly connectTimeoutMs?: number;
|
|
3965
4014
|
/** Enable TLS (MLLPS) for this connection. Passthrough to `ClientOptions.tls`. */
|
|
3966
4015
|
readonly tls?: TlsOptions | true;
|
|
3967
4016
|
/**
|
|
@@ -4372,7 +4421,9 @@ declare function isTlsProtocolError(err: unknown): boolean;
|
|
|
4372
4421
|
* Classification table:
|
|
4373
4422
|
* - `ENOTFOUND`, `EACCES` → **permanent** (`false`)
|
|
4374
4423
|
* - `ECONNREFUSED`, `ECONNRESET`, `ETIMEDOUT`, `EHOSTUNREACH`,
|
|
4375
|
-
* `ENETUNREACH`, `EPIPE` → **transient** (`true`)
|
|
4424
|
+
* `ENETUNREACH`, `EPIPE` → **transient** (`true`). An expired
|
|
4425
|
+
* `ClientOptions.connectTimeoutMs` is one of these: its error carries
|
|
4426
|
+
* `ETIMEDOUT`, the code of the operating system's own connect timeout.
|
|
4376
4427
|
* - `CERT_*` and `UNABLE_TO_VERIFY_LEAF_SIGNATURE` /
|
|
4377
4428
|
* `DEPTH_ZERO_SELF_SIGNED_CERT` / `SELF_SIGNED_CERT_IN_CHAIN`
|
|
4378
4429
|
* (any {@link isTlsVerificationErrorCode} code) → **permanent** (`false`),
|
package/dist/index.d.ts
CHANGED
|
@@ -1615,9 +1615,18 @@ type ConnectionErrorPhase = "connect" | "send" | "receive" | "close" | "reconnec
|
|
|
1615
1615
|
* server, …). See `isTlsProtocolError` for the boundary. Pure TCP-level
|
|
1616
1616
|
* failures (`ECONNREFUSED`, `ETIMEDOUT`, …) on a TLS-configured
|
|
1617
1617
|
* connection carry **no** `connectionCause`, the same shape as plaintext.
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1620
|
-
*
|
|
1618
|
+
* - `'framing-fatal'`, the peer sent bytes the decoder could not accept, or a
|
|
1619
|
+
* frame past the size cap. Classified **permanent**.
|
|
1620
|
+
* - `'connect-timeout'`, the connection was not established within
|
|
1621
|
+
* `ClientOptions.connectTimeoutMs`: the TCP connect, or the TLS handshake
|
|
1622
|
+
* after it, did not complete in time and the socket was destroyed. Nothing
|
|
1623
|
+
* was written, so no message reached the peer. The `cause` carries
|
|
1624
|
+
* `code: 'ETIMEDOUT'`, and it is classified **transient** by
|
|
1625
|
+
* `isTransientConnectionError`, like the operating system's own connect
|
|
1626
|
+
* timeout: a peer that is down or unreachable now may answer later.
|
|
1627
|
+
*
|
|
1628
|
+
* Scope note: the `'tls-verify'`/`'tls-handshake'`/`'connect-timeout'` values
|
|
1629
|
+
* are attached on the client's **initial `connect()` path**. Failures on the auto-reconnect
|
|
1621
1630
|
* path surface as raw socket errors, their transient/permanent
|
|
1622
1631
|
* classification still applies, but they do not (yet) carry a
|
|
1623
1632
|
* `connectionCause`.
|
|
@@ -1630,7 +1639,7 @@ type ConnectionErrorPhase = "connect" | "send" | "receive" | "close" | "reconnec
|
|
|
1630
1639
|
* }
|
|
1631
1640
|
* ```
|
|
1632
1641
|
*/
|
|
1633
|
-
type ConnectionErrorCause = "fifo-unsafe" | "in-flight-orphan" | "tls-verify" | "tls-handshake" | "framing-fatal";
|
|
1642
|
+
type ConnectionErrorCause = "fifo-unsafe" | "in-flight-orphan" | "tls-verify" | "tls-handshake" | "framing-fatal" | "connect-timeout";
|
|
1634
1643
|
/**
|
|
1635
1644
|
* Thrown (or emitted via `onError`) for socket-layer problems such as
|
|
1636
1645
|
* connection refused, ECONNRESET, ETIMEDOUT, or DNS failure.
|
|
@@ -3142,6 +3151,26 @@ interface ClientOptions {
|
|
|
3142
3151
|
* @default undefined (off)
|
|
3143
3152
|
*/
|
|
3144
3153
|
readonly deadPeerTimeoutMs?: number;
|
|
3154
|
+
/**
|
|
3155
|
+
* Bound, in milliseconds, on establishing each connection: the TCP connect and, when
|
|
3156
|
+
* {@link ClientOptions.tls} is set, the TLS handshake after it. The clock starts when the
|
|
3157
|
+
* socket is created and stops at `'connect'` (plaintext) or `'secureConnect'` (TLS).
|
|
3158
|
+
*
|
|
3159
|
+
* On expiry the socket is destroyed. On `connect()` the promise rejects with an
|
|
3160
|
+
* `MllpConnectionError` whose `phase` is `'connect'` and whose `connectionCause` is
|
|
3161
|
+
* `'connect-timeout'`; nothing was written, so no message can have reached the peer. On an
|
|
3162
|
+
* auto-reconnect attempt the failure feeds the reconnect policy like any other connect
|
|
3163
|
+
* failure: `RetryContext.lastError` carries `code: 'ETIMEDOUT'` and it is classified
|
|
3164
|
+
* **transient**, so the client backs off and tries again.
|
|
3165
|
+
*
|
|
3166
|
+
* Must be an integer from 1 to 2147483647 (the largest delay a Node timer takes); anything else
|
|
3167
|
+
* throws a `RangeError` at construction. Unset means no bound of our own: a connect waits on
|
|
3168
|
+
* the operating system, and a TLS handshake against a peer that accepts the TCP connection and
|
|
3169
|
+
* never answers waits indefinitely.
|
|
3170
|
+
*
|
|
3171
|
+
* @default undefined (no bound)
|
|
3172
|
+
*/
|
|
3173
|
+
readonly connectTimeoutMs?: number;
|
|
3145
3174
|
/**
|
|
3146
3175
|
* Enable TLS (MLLPS) for this connection. `true` enables TLS with
|
|
3147
3176
|
* all defaults, including certificate verification **on**. Pass a
|
|
@@ -3381,6 +3410,9 @@ declare class MllpClient extends EventEmitter {
|
|
|
3381
3410
|
* TLS failures carry a `connectionCause`: `'tls-verify'` for certificate
|
|
3382
3411
|
* verification failures, `'tls-handshake'` for TLS-protocol-shaped failures
|
|
3383
3412
|
* ({@link isTlsProtocolError}); pure TCP failures carry none.
|
|
3413
|
+
* - `MllpConnectionError({ phase: 'connect', connectionCause: 'connect-timeout' })` if
|
|
3414
|
+
* {@link ClientOptions.connectTimeoutMs} is set and the TCP connect, or the TLS handshake
|
|
3415
|
+
* after it, did not complete in time. The socket is destroyed; nothing was written.
|
|
3384
3416
|
* - `MllpTlsConfigurationError` if the configured cipher-suite list cannot be
|
|
3385
3417
|
* honoured (the runtime rejects it, or `atnaTransportSecurity` and `ciphers`
|
|
3386
3418
|
* both declare one). Raised **before** a socket is opened, so nothing is left
|
|
@@ -3425,6 +3457,18 @@ declare class MllpClient extends EventEmitter {
|
|
|
3425
3457
|
* against it.
|
|
3426
3458
|
*/
|
|
3427
3459
|
private _createSocketAndTransport;
|
|
3460
|
+
/**
|
|
3461
|
+
* Bound one connection attempt by {@link ClientOptions.connectTimeoutMs}, when it is set.
|
|
3462
|
+
*
|
|
3463
|
+
* Armed after the `Connection` has registered its own socket listeners (its set-once
|
|
3464
|
+
* `onClose`/`onError` would otherwise remove ours). The timer stops at the socket's connect
|
|
3465
|
+
* event (`'secureConnect'` for TLS, so the handshake is inside the bound) or at its `'close'`,
|
|
3466
|
+
* whichever comes first; a refused connect or an abort therefore leaves no timer behind. On
|
|
3467
|
+
* expiry the socket is destroyed with a {@link ConnectTimeoutCause}, which reaches the same
|
|
3468
|
+
* `'error'` listeners as any other connect failure: `connect()` rejects, and a reconnect
|
|
3469
|
+
* attempt hands it to the reconnect classifier.
|
|
3470
|
+
*/
|
|
3471
|
+
private _armConnectTimeout;
|
|
3428
3472
|
/**
|
|
3429
3473
|
* Wrap a connect-phase socket error as `MllpConnectionError`, classifying
|
|
3430
3474
|
* TLS failures into the additive `connectionCause`:
|
|
@@ -3962,6 +4006,11 @@ interface StarterClientOptions {
|
|
|
3962
4006
|
readonly keepaliveIntervalMs?: number;
|
|
3963
4007
|
/** Application-idle dead-peer timeout ms. */
|
|
3964
4008
|
readonly deadPeerTimeoutMs?: number;
|
|
4009
|
+
/**
|
|
4010
|
+
* Bound on the TCP connect and TLS handshake, in ms. Passthrough to
|
|
4011
|
+
* `ClientOptions.connectTimeoutMs`; unset means no bound, as there.
|
|
4012
|
+
*/
|
|
4013
|
+
readonly connectTimeoutMs?: number;
|
|
3965
4014
|
/** Enable TLS (MLLPS) for this connection. Passthrough to `ClientOptions.tls`. */
|
|
3966
4015
|
readonly tls?: TlsOptions | true;
|
|
3967
4016
|
/**
|
|
@@ -4372,7 +4421,9 @@ declare function isTlsProtocolError(err: unknown): boolean;
|
|
|
4372
4421
|
* Classification table:
|
|
4373
4422
|
* - `ENOTFOUND`, `EACCES` → **permanent** (`false`)
|
|
4374
4423
|
* - `ECONNREFUSED`, `ECONNRESET`, `ETIMEDOUT`, `EHOSTUNREACH`,
|
|
4375
|
-
* `ENETUNREACH`, `EPIPE` → **transient** (`true`)
|
|
4424
|
+
* `ENETUNREACH`, `EPIPE` → **transient** (`true`). An expired
|
|
4425
|
+
* `ClientOptions.connectTimeoutMs` is one of these: its error carries
|
|
4426
|
+
* `ETIMEDOUT`, the code of the operating system's own connect timeout.
|
|
4376
4427
|
* - `CERT_*` and `UNABLE_TO_VERIFY_LEAF_SIGNATURE` /
|
|
4377
4428
|
* `DEPTH_ZERO_SELF_SIGNED_CERT` / `SELF_SIGNED_CERT_IN_CHAIN`
|
|
4378
4429
|
* (any {@link isTlsVerificationErrorCode} code) → **permanent** (`false`),
|
package/dist/index.mjs
CHANGED
|
@@ -3237,6 +3237,14 @@ var OUTBOUND_WARNING_CONTEXT = Object.freeze({
|
|
|
3237
3237
|
byteOffset: 0,
|
|
3238
3238
|
elapsedSinceSendMs: 0
|
|
3239
3239
|
});
|
|
3240
|
+
var MAX_CONNECT_TIMEOUT_MS = 2147483647;
|
|
3241
|
+
var CONNECT_TIMEOUT_MESSAGE = "connect timed out: the connection, including its TLS handshake when TLS is on, was not established within connectTimeoutMs";
|
|
3242
|
+
var ConnectTimeoutCause = class extends Error {
|
|
3243
|
+
code = "ETIMEDOUT";
|
|
3244
|
+
constructor() {
|
|
3245
|
+
super(CONNECT_TIMEOUT_MESSAGE);
|
|
3246
|
+
}
|
|
3247
|
+
};
|
|
3240
3248
|
function identityOptions(host, servername) {
|
|
3241
3249
|
const target = servername ?? host;
|
|
3242
3250
|
if (isIP(target) === 0) return { servername: target };
|
|
@@ -3367,6 +3375,12 @@ var MllpClient = class extends EventEmitter {
|
|
|
3367
3375
|
*/
|
|
3368
3376
|
constructor(opts) {
|
|
3369
3377
|
super();
|
|
3378
|
+
const connectTimeoutMs = opts.connectTimeoutMs;
|
|
3379
|
+
if (connectTimeoutMs !== void 0 && !(Number.isInteger(connectTimeoutMs) && connectTimeoutMs >= 1 && connectTimeoutMs <= MAX_CONNECT_TIMEOUT_MS)) {
|
|
3380
|
+
throw new RangeError(
|
|
3381
|
+
"ClientOptions.connectTimeoutMs must be an integer from 1 to 2147483647, or left unset for no bound"
|
|
3382
|
+
);
|
|
3383
|
+
}
|
|
3370
3384
|
this._opts = opts;
|
|
3371
3385
|
this._ackTimeoutMs = opts.ackTimeoutMs ?? 3e4;
|
|
3372
3386
|
this._applicationAckTimeoutMs = opts.applicationAckTimeoutMs;
|
|
@@ -3410,6 +3424,9 @@ var MllpClient = class extends EventEmitter {
|
|
|
3410
3424
|
* TLS failures carry a `connectionCause`: `'tls-verify'` for certificate
|
|
3411
3425
|
* verification failures, `'tls-handshake'` for TLS-protocol-shaped failures
|
|
3412
3426
|
* ({@link isTlsProtocolError}); pure TCP failures carry none.
|
|
3427
|
+
* - `MllpConnectionError({ phase: 'connect', connectionCause: 'connect-timeout' })` if
|
|
3428
|
+
* {@link ClientOptions.connectTimeoutMs} is set and the TCP connect, or the TLS handshake
|
|
3429
|
+
* after it, did not complete in time. The socket is destroyed; nothing was written.
|
|
3413
3430
|
* - `MllpTlsConfigurationError` if the configured cipher-suite list cannot be
|
|
3414
3431
|
* honoured (the runtime rejects it, or `atnaTransportSecurity` and `ciphers`
|
|
3415
3432
|
* both declare one). Raised **before** a socket is opened, so nothing is left
|
|
@@ -3468,6 +3485,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
3468
3485
|
const conn = new Connection(connOpts);
|
|
3469
3486
|
this._attachConnection(conn);
|
|
3470
3487
|
const connectEventName = this._opts.tls !== void 0 ? "secureConnect" : "connect";
|
|
3488
|
+
this._armConnectTimeout(socket, connectEventName);
|
|
3471
3489
|
const cleanup = () => {
|
|
3472
3490
|
if (signal !== void 0) {
|
|
3473
3491
|
signal.removeEventListener("abort", abortHandler);
|
|
@@ -3542,6 +3560,29 @@ var MllpClient = class extends EventEmitter {
|
|
|
3542
3560
|
});
|
|
3543
3561
|
return { socket, transport: new TlsTransport(socket) };
|
|
3544
3562
|
}
|
|
3563
|
+
/**
|
|
3564
|
+
* Bound one connection attempt by {@link ClientOptions.connectTimeoutMs}, when it is set.
|
|
3565
|
+
*
|
|
3566
|
+
* Armed after the `Connection` has registered its own socket listeners (its set-once
|
|
3567
|
+
* `onClose`/`onError` would otherwise remove ours). The timer stops at the socket's connect
|
|
3568
|
+
* event (`'secureConnect'` for TLS, so the handshake is inside the bound) or at its `'close'`,
|
|
3569
|
+
* whichever comes first; a refused connect or an abort therefore leaves no timer behind. On
|
|
3570
|
+
* expiry the socket is destroyed with a {@link ConnectTimeoutCause}, which reaches the same
|
|
3571
|
+
* `'error'` listeners as any other connect failure: `connect()` rejects, and a reconnect
|
|
3572
|
+
* attempt hands it to the reconnect classifier.
|
|
3573
|
+
*/
|
|
3574
|
+
_armConnectTimeout(socket, connectEventName) {
|
|
3575
|
+
const timeoutMs = this._opts.connectTimeoutMs;
|
|
3576
|
+
if (timeoutMs === void 0) return;
|
|
3577
|
+
const timer = setTimeout(() => {
|
|
3578
|
+
socket.destroy(new ConnectTimeoutCause());
|
|
3579
|
+
}, timeoutMs);
|
|
3580
|
+
const stop = () => {
|
|
3581
|
+
clearTimeout(timer);
|
|
3582
|
+
};
|
|
3583
|
+
socket.once(connectEventName, stop);
|
|
3584
|
+
socket.once("close", stop);
|
|
3585
|
+
}
|
|
3545
3586
|
/**
|
|
3546
3587
|
* Wrap a connect-phase socket error as `MllpConnectionError`, classifying
|
|
3547
3588
|
* TLS failures into the additive `connectionCause`:
|
|
@@ -3556,6 +3597,13 @@ var MllpClient = class extends EventEmitter {
|
|
|
3556
3597
|
* same shape as plaintext connect failures.
|
|
3557
3598
|
*/
|
|
3558
3599
|
_wrapConnectError(err, phase) {
|
|
3600
|
+
if (err instanceof ConnectTimeoutCause) {
|
|
3601
|
+
return new MllpConnectionError(err.message, {
|
|
3602
|
+
cause: err,
|
|
3603
|
+
phase,
|
|
3604
|
+
connectionCause: "connect-timeout"
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3559
3607
|
if (this._opts.tls === void 0) {
|
|
3560
3608
|
return new MllpConnectionError(err.message, { cause: err, phase });
|
|
3561
3609
|
}
|
|
@@ -4048,6 +4096,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
4048
4096
|
this._emitNegotiatedTlsParameters(socket);
|
|
4049
4097
|
};
|
|
4050
4098
|
const connectEventName = this._opts.tls !== void 0 ? "secureConnect" : "connect";
|
|
4099
|
+
this._armConnectTimeout(socket, connectEventName);
|
|
4051
4100
|
socket.once("error", (sErr) => {
|
|
4052
4101
|
if (this._lastError === null || this._lastError.message !== sErr.message) {
|
|
4053
4102
|
this._lastError = sErr;
|
|
@@ -4860,6 +4909,7 @@ async function createStarterClient(opts) {
|
|
|
4860
4909
|
...opts.retryStrategy !== void 0 ? { retryStrategy: opts.retryStrategy } : {},
|
|
4861
4910
|
...opts.keepaliveIntervalMs !== void 0 ? { keepaliveIntervalMs: opts.keepaliveIntervalMs } : {},
|
|
4862
4911
|
...opts.deadPeerTimeoutMs !== void 0 ? { deadPeerTimeoutMs: opts.deadPeerTimeoutMs } : {},
|
|
4912
|
+
...opts.connectTimeoutMs !== void 0 ? { connectTimeoutMs: opts.connectTimeoutMs } : {},
|
|
4863
4913
|
...opts.tls !== void 0 ? { tls: opts.tls } : {}
|
|
4864
4914
|
};
|
|
4865
4915
|
const client = createClient(clientOpts);
|
|
@@ -5180,7 +5230,7 @@ async function runDifferential(options = {}) {
|
|
|
5180
5230
|
}
|
|
5181
5231
|
|
|
5182
5232
|
// src/index.ts
|
|
5183
|
-
var VERSION = "0.1.
|
|
5233
|
+
var VERSION = "0.1.11";
|
|
5184
5234
|
|
|
5185
5235
|
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, VERSION, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, createWarning, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
5186
5236
|
//# sourceMappingURL=index.mjs.map
|