Skip to content

Commit d47af4c

Browse files
authored
fix(socket): TLS connection correctly times out (#41)
Signed-off-by: Ray Tung <ray@kasada.io> Signed-off-by: Ray Tung <ray@kasada.io>
1 parent e8ce81b commit d47af4c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/socket.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,11 @@ export class FluentSocket extends EventEmitter {
400400
* @returns A new socket to use for the connection
401401
*/
402402
private createTlsSocket(): tls.TLSSocket {
403-
return tls.connect({...this.tlsOptions, ...this.socketParams});
403+
let opts: net.NetConnectOpts = {...this.tlsOptions, ...this.socketParams};
404+
if (this.timeout >= 0) {
405+
opts = {...opts, timeout: this.timeout};
406+
}
407+
return tls.connect(opts);
404408
}
405409

406410
/**

0 commit comments

Comments
 (0)