TCP is the only option so remove unused branches
Summary: As TCP is the only option, remove all branches. Reviewed By: passy Differential Revision: D48265093 fbshipit-source-id: 174527f05d8a841797fd95256e77fdeb9b2e6ad5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
47b718d104
commit
7f3f1c0507
@@ -206,7 +206,6 @@ async function getFlipperServer(
|
|||||||
const {readyForIncomingConnections} = await startServer({
|
const {readyForIncomingConnections} = await startServer({
|
||||||
staticPath,
|
staticPath,
|
||||||
entry: 'index.web.dev.html',
|
entry: 'index.web.dev.html',
|
||||||
tcp: false,
|
|
||||||
port,
|
port,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ type Config = {
|
|||||||
port: number;
|
port: number;
|
||||||
staticPath: string;
|
staticPath: string;
|
||||||
entry: string;
|
entry: string;
|
||||||
tcp: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type ReadyForConnections = (
|
type ReadyForConnections = (
|
||||||
@@ -151,11 +150,6 @@ async function startProxyServer(
|
|||||||
// On Windows, a proxy is not created and the server starts
|
// On Windows, a proxy is not created and the server starts
|
||||||
// listening at the specified port.
|
// listening at the specified port.
|
||||||
if (os.platform() === 'win32') {
|
if (os.platform() === 'win32') {
|
||||||
if (!config.tcp) {
|
|
||||||
console.warn(
|
|
||||||
'No port was supplied and domain socket access is not available for non-POSIX systems, falling back to TCP',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
console.log(`Starting server on http://localhost:${config.port}`);
|
console.log(`Starting server on http://localhost:${config.port}`);
|
||||||
const readyForIncomingConnections = (
|
const readyForIncomingConnections = (
|
||||||
@@ -182,13 +176,11 @@ async function startProxyServer(
|
|||||||
await fs.rm(socketPath, {force: true});
|
await fs.rm(socketPath, {force: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
const proxyServer: proxy | undefined = config.tcp
|
const proxyServer: proxy | undefined = proxy.createProxyServer({
|
||||||
? proxy.createProxyServer({
|
target: {host: 'localhost', port: 0, socketPath},
|
||||||
target: {host: 'localhost', port: 0, socketPath},
|
autoRewrite: true,
|
||||||
autoRewrite: true,
|
ws: true,
|
||||||
ws: true,
|
});
|
||||||
})
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
console.log('Starting socket server on ', socketPath);
|
console.log('Starting socket server on ', socketPath);
|
||||||
if (proxyServer) {
|
if (proxyServer) {
|
||||||
@@ -230,7 +222,6 @@ async function startProxyServer(
|
|||||||
server.listen(socketPath, undefined, () => {
|
server.listen(socketPath, undefined, () => {
|
||||||
tracker.track('server-started', {
|
tracker.track('server-started', {
|
||||||
port: config.port,
|
port: config.port,
|
||||||
tcp: config.tcp,
|
|
||||||
});
|
});
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
@@ -275,8 +266,6 @@ function addWebsocket(server: http.Server, config: Config) {
|
|||||||
// No origin header? The request is not originating from a browser, so should be OK to pass through
|
// No origin header? The request is not originating from a browser, so should be OK to pass through
|
||||||
// If origin matches our own address, it means we are serving the page.
|
// If origin matches our own address, it means we are serving the page.
|
||||||
|
|
||||||
// Need the token or know that is UDS.
|
|
||||||
|
|
||||||
return process.env.SKIP_TOKEN_VERIFICATION ? true : verifyAuthToken(req);
|
return process.env.SKIP_TOKEN_VERIFICATION ? true : verifyAuthToken(req);
|
||||||
} else {
|
} else {
|
||||||
// For now we don't allow cross origin request, so that an arbitrary website cannot try to
|
// For now we don't allow cross origin request, so that an arbitrary website cannot try to
|
||||||
@@ -299,10 +288,8 @@ function addWebsocket(server: http.Server, config: Config) {
|
|||||||
const options: ServerOptions = {
|
const options: ServerOptions = {
|
||||||
noServer: true,
|
noServer: true,
|
||||||
maxPayload: WEBSOCKET_MAX_MESSAGE_SIZE,
|
maxPayload: WEBSOCKET_MAX_MESSAGE_SIZE,
|
||||||
|
verifyClient,
|
||||||
};
|
};
|
||||||
if (config.tcp) {
|
|
||||||
options.verifyClient = verifyClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wss = new WebSocketServer(options);
|
const wss = new WebSocketServer(options);
|
||||||
server.on('upgrade', function upgrade(request, socket, head) {
|
server.on('upgrade', function upgrade(request, socket, head) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type ServerBootstrapPerformancePayload = {
|
|||||||
|
|
||||||
type TrackerEvents = {
|
type TrackerEvents = {
|
||||||
'server-bootstrap-performance': ServerBootstrapPerformancePayload;
|
'server-bootstrap-performance': ServerBootstrapPerformancePayload;
|
||||||
'server-started': {port: number; tcp: boolean};
|
'server-started': {port: number};
|
||||||
'server-auth-token-verification': {
|
'server-auth-token-verification': {
|
||||||
successful: boolean;
|
successful: boolean;
|
||||||
present: boolean;
|
present: boolean;
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ async function start() {
|
|||||||
staticPath,
|
staticPath,
|
||||||
entry: `index.web${argv.bundler ? '.dev' : ''}.html`,
|
entry: `index.web${argv.bundler ? '.dev' : ''}.html`,
|
||||||
port: argv.port,
|
port: argv.port,
|
||||||
tcp: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const t4 = performance.now();
|
const t4 = performance.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user