mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 20:55:25 +00:00
Run ssh server listen after http
That way if they happen to conflict code-server doesn't crash.
This commit is contained in:
parent
6c104c016e
commit
a4c0fd1fdc
@ -79,17 +79,6 @@ const main = async (args: Args): Promise<void> => {
|
|||||||
ipcMain().onDispose(() => httpServer.dispose())
|
ipcMain().onDispose(() => httpServer.dispose())
|
||||||
|
|
||||||
logger.info(`code-server ${version} ${commit}`)
|
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()
|
const serverAddress = await httpServer.listen()
|
||||||
logger.info(`HTTP server listening on ${serverAddress}`)
|
logger.info(`HTTP server listening on ${serverAddress}`)
|
||||||
|
|
||||||
@ -117,6 +106,16 @@ const main = async (args: Args): Promise<void> => {
|
|||||||
|
|
||||||
logger.info(`Automatic updates are ${update.enabled ? "enabled" : "disabled"}`)
|
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") {
|
if (typeof sshPort !== "undefined") {
|
||||||
logger.info(`SSH server listening on localhost:${sshPort}`)
|
logger.info(`SSH server listening on localhost:${sshPort}`)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user