mirror of
https://github.com/koush/scrypted.git
synced 2026-09-17 09:10:38 +01:00
server: force ipv4 on cluster connect
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { ForkOptions } from '@scrypted/types';
|
||||
import { once } from 'events';
|
||||
import net from 'net';
|
||||
import { install as installSourceMapSupport } from 'source-map-support';
|
||||
import type { Readable } from 'stream';
|
||||
import tls from 'tls';
|
||||
@@ -109,9 +110,22 @@ export function startClusterClient(mainFilename: string) {
|
||||
// to hang the app since no window is created yet.
|
||||
await sleep(1000);
|
||||
|
||||
const socket = tls.connect({
|
||||
const rawSocket = net.connect({
|
||||
host,
|
||||
port,
|
||||
// require ipv4 to normalize cluster address.
|
||||
family: 4,
|
||||
});
|
||||
|
||||
try {
|
||||
await once(rawSocket, 'connect');
|
||||
}
|
||||
catch( e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const socket = tls.connect({
|
||||
socket: rawSocket,
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user