Remove UDS and thus the need for a proxy server

Summary: This change removes the UDS support and thus the need for having a proxy server.

Reviewed By: antonk52

Differential Revision: D48265244

fbshipit-source-id: c76bb4afba63959ddd17901b3887aa278b000beb
This commit is contained in:
Lorenzo Blasa
2023-08-11 08:19:51 -07:00
committed by Facebook GitHub Bot
parent 7f3f1c0507
commit b5ed57b7d0
4 changed files with 6 additions and 163 deletions

View File

@@ -47,7 +47,6 @@ import path from 'path';
import fs from 'fs-extra';
import os from 'os';
import {ElectronIpcClientRenderer} from './electronIpc';
import {checkSocketInUse, makeSocketPath} from 'flipper-server-core';
import {KeytarModule} from 'flipper-server-core/src/utils/keytar';
import {initCompanionEnv} from 'flipper-server-companion';
import ReconnectingWebSocket from 'reconnecting-websocket';
@@ -118,8 +117,6 @@ async function getFlipperServer(
const serverUsageEnabled = gatekeepers['flipper_desktop_use_server'];
const settings = await loadSettings();
const socketPath = await makeSocketPath();
const port = 52342;
/**
* Only attempt to use the auth token if one is available. Otherwise,
@@ -134,7 +131,6 @@ async function getFlipperServer(
// check first with the actual TCP socket
const searchParams = new URLSearchParams(token ? {token} : {});
const TCPconnectionURL = new URL(`ws://localhost:${port}?${searchParams}`);
const UDSconnectionURL = new URL(`ws+unix://${socketPath}`);
/**
* Attempt to shutdown a running instance of Flipper server.
@@ -159,12 +155,7 @@ async function getFlipperServer(
*/
if (await checkPortInUse(port)) {
console.warn(`[flipper-server] TCP port ${port} is already in use.`);
await shutdown(TCPconnectionURL);
} else if (await checkSocketInUse(socketPath)) {
console.warn(`[flipper-server] UDS socket is already in use.`);
await shutdown(UDSconnectionURL);
}
const [homePath, tempPath, desktopPath] = await Promise.all([
@@ -223,9 +214,7 @@ async function getFlipperServer(
await server.connect();
await readyForIncomingConnections(server, companionEnv);
return getExternalServer(
os.platform() === 'win32' ? TCPconnectionURL : UDSconnectionURL,
);
return getExternalServer(TCPconnectionURL);
}
return getEmbeddedServer();
}