From a4c0fd1fdc9ff59fc097f92f1cb2d3698833ce62 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 30 Mar 2020 16:22:24 -0500 Subject: [PATCH] Run ssh server listen after http That way if they happen to conflict code-server doesn't crash. --- src/node/entry.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/node/entry.ts b/src/node/entry.ts index 88a16e81..a784338f 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -79,17 +79,6 @@ const main = async (args: Args): Promise => { ipcMain().onDispose(() => httpServer.dispose()) logger.info(`code-server ${version} ${commit}`) - - let sshPort: number | undefined - if (!args["disable-ssh"] && options.sshHostKey) { - const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string) - try { - sshPort = await sshProvider.listen() - } catch (error) { - logger.warn(`SSH server: ${error.message}`) - } - } - const serverAddress = await httpServer.listen() logger.info(`HTTP server listening on ${serverAddress}`) @@ -117,6 +106,16 @@ const main = async (args: Args): Promise => { logger.info(`Automatic updates are ${update.enabled ? "enabled" : "disabled"}`) + let sshPort: number | undefined + if (!args["disable-ssh"] && options.sshHostKey) { + const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string) + try { + sshPort = await sshProvider.listen() + } catch (error) { + logger.warn(`SSH server: ${error.message}`) + } + } + if (typeof sshPort !== "undefined") { logger.info(`SSH server listening on localhost:${sshPort}`) } else {