@@ -6,6 +6,7 @@ import * as ipc from "../../lib/vscode/src/vs/server/ipc"
6
6
import { arrayify , generateUuid } from "../common/util"
7
7
import { rootPath } from "./constants"
8
8
import { settings } from "./settings"
9
+ import { SocketProxyProvider } from "./socket"
9
10
import { isFile } from "./util"
10
11
import { ipcMain } from "./wrapper"
11
12
@@ -14,6 +15,7 @@ export class VscodeProvider {
14
15
public readonly vsRootPath : string
15
16
private _vscode ?: Promise < cp . ChildProcess >
16
17
private timeoutInterval = 10000 // 10s, matches VS Code's timeouts.
18
+ private readonly socketProvider = new SocketProxyProvider ( )
17
19
18
20
public constructor ( ) {
19
21
this . vsRootPath = path . resolve ( rootPath , "lib/vscode" )
@@ -22,6 +24,7 @@ export class VscodeProvider {
22
24
}
23
25
24
26
public async dispose ( ) : Promise < void > {
27
+ this . socketProvider . stop ( )
25
28
if ( this . _vscode ) {
26
29
const vscode = await this . _vscode
27
30
vscode . removeAllListeners ( )
@@ -152,9 +155,11 @@ export class VscodeProvider {
152
155
* VS Code expects a raw socket. It will handle all the web socket frames.
153
156
*/
154
157
public async sendWebsocket ( socket : net . Socket , query : ipc . Query ) : Promise < void > {
155
- // TODO: TLS socket proxy.
156
158
const vscode = await this . _vscode
157
- this . send ( { type : "socket" , query } , vscode , socket )
159
+ // TLS sockets cannot be transferred to child processes so we need an
160
+ // in-between. Non-TLS sockets will be returned as-is.
161
+ const socketProxy = await this . socketProvider . createProxy ( socket )
162
+ this . send ( { type : "socket" , query } , vscode , socketProxy )
158
163
}
159
164
160
165
private send ( message : ipc . CodeServerMessage , vscode ?: cp . ChildProcess , socket ?: net . Socket ) : void {
0 commit comments