Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ec64531d
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ec64531d
编写于
10月 27, 2021
作者:
A
Alex Ross
提交者:
GitHub
10月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tunnels in shared process should be per remote (#135937)
Fixes microsoft/vscode-remote-release#5706
上级
aaa4e0a3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
11 deletion
+48
-11
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+3
-3
src/vs/platform/remote/common/sharedProcessTunnelService.ts
src/vs/platform/remote/common/sharedProcessTunnelService.ts
+1
-1
src/vs/platform/remote/common/tunnel.ts
src/vs/platform/remote/common/tunnel.ts
+7
-0
src/vs/platform/remote/node/sharedProcessTunnelService.ts
src/vs/platform/remote/node/sharedProcessTunnelService.ts
+4
-4
src/vs/platform/remote/node/tunnelService.ts
src/vs/platform/remote/node/tunnelService.ts
+31
-1
src/vs/workbench/services/remote/electron-sandbox/tunnelServiceImpl.ts
...nch/services/remote/electron-sandbox/tunnelServiceImpl.ts
+2
-2
未找到文件。
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
ec64531d
...
...
@@ -88,8 +88,8 @@ import { IExtensionHostStarter, ipcExtensionHostStarterChannelName } from 'vs/pl
import
{
ExtensionHostStarter
}
from
'
vs/platform/extensions/node/extensionHostStarter
'
;
import
{
ISignService
}
from
'
vs/platform/sign/common/sign
'
;
import
{
SignService
}
from
'
vs/platform/sign/node/signService
'
;
import
{
I
Tunnel
Service
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
Tunnel
Service
}
from
'
vs/platform/remote/node/tunnelService
'
;
import
{
I
SharedTunnels
Service
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
SharedTunnels
Service
}
from
'
vs/platform/remote/node/tunnelService
'
;
import
{
ipcSharedProcessTunnelChannelName
,
ISharedProcessTunnelService
}
from
'
vs/platform/remote/common/sharedProcessTunnelService
'
;
import
{
SharedProcessTunnelService
}
from
'
vs/platform/remote/node/sharedProcessTunnelService
'
;
import
{
ipcSharedProcessWorkerChannelName
,
ISharedProcessWorkerConfiguration
,
ISharedProcessWorkerService
}
from
'
vs/platform/sharedProcess/common/sharedProcessWorkerService
'
;
...
...
@@ -326,7 +326,7 @@ class SharedProcessMain extends Disposable {
services
.
set
(
ISignService
,
new
SyncDescriptor
(
SignService
));
// Tunnel
services
.
set
(
I
TunnelService
,
new
SyncDescriptor
(
Tunnel
Service
));
services
.
set
(
I
SharedTunnelsService
,
new
SyncDescriptor
(
SharedTunnels
Service
));
services
.
set
(
ISharedProcessTunnelService
,
new
SyncDescriptor
(
SharedProcessTunnelService
));
return
new
InstantiationService
(
services
);
...
...
src/vs/platform/remote/common/sharedProcessTunnelService.ts
浏览文件 @
ec64531d
...
...
@@ -29,7 +29,7 @@ export interface ISharedProcessTunnelService {
* Start a previously created tunnel.
* Can only be called once per created tunnel.
*/
startTunnel
(
id
:
string
,
tunnelRemoteHost
:
string
,
tunnelRemotePort
:
number
,
tunnelLocalPort
:
number
|
undefined
,
elevateIfNeeded
:
boolean
|
undefined
):
Promise
<
ISharedProcessTunnel
>
;
startTunnel
(
authority
:
string
,
id
:
string
,
tunnelRemoteHost
:
string
,
tunnelRemotePort
:
number
,
tunnelLocalPort
:
number
|
undefined
,
elevateIfNeeded
:
boolean
|
undefined
):
Promise
<
ISharedProcessTunnel
>
;
/**
* Set the remote address info for a previously created tunnel.
* Should be called as often as the resolver resolves.
...
...
src/vs/platform/remote/common/tunnel.ts
浏览文件 @
ec64531d
...
...
@@ -13,6 +13,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
IAddressProvider
}
from
'
vs/platform/remote/common/remoteAgentConnection
'
;
export
const
ITunnelService
=
createDecorator
<
ITunnelService
>
(
'
tunnelService
'
);
export
const
ISharedTunnelsService
=
createDecorator
<
ISharedTunnelsService
>
(
'
sharedTunnelsService
'
);
export
interface
RemoteTunnel
{
readonly
tunnelRemotePort
:
number
;
...
...
@@ -110,6 +111,12 @@ export interface ITunnel {
dispose
():
Promise
<
void
>
|
void
;
}
export
interface
ISharedTunnelsService
{
readonly
_serviceBrand
:
undefined
;
openTunnel
(
authority
:
string
,
addressProvider
:
IAddressProvider
|
undefined
,
remoteHost
:
string
|
undefined
,
remotePort
:
number
,
localPort
?:
number
,
elevateIfNeeded
?:
boolean
,
privacy
?:
string
,
protocol
?:
string
):
Promise
<
RemoteTunnel
|
undefined
>
|
undefined
;
}
export
interface
ITunnelService
{
readonly
_serviceBrand
:
undefined
;
...
...
src/vs/platform/remote/node/sharedProcessTunnelService.ts
浏览文件 @
ec64531d
...
...
@@ -5,7 +5,7 @@
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ISharedProcessTunnel
,
ISharedProcessTunnelService
}
from
'
vs/platform/remote/common/sharedProcessTunnelService
'
;
import
{
I
Tunnel
Service
,
RemoteTunnel
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
I
SharedTunnels
Service
,
RemoteTunnel
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
IAddress
,
IAddressProvider
}
from
'
vs/platform/remote/common/remoteAgentConnection
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
canceled
}
from
'
vs/base/common/errors
'
;
...
...
@@ -55,7 +55,7 @@ export class SharedProcessTunnelService extends Disposable implements ISharedPro
private
readonly
_disposedTunnels
:
Set
<
string
>
=
new
Set
<
string
>
();
constructor
(
@
I
TunnelService
private
readonly
_tunnelService
:
ITunnel
Service
,
@
I
SharedTunnelsService
private
readonly
_tunnelService
:
ISharedTunnels
Service
,
@
ILogService
private
readonly
_logService
:
ILogService
,
)
{
super
();
...
...
@@ -71,10 +71,10 @@ export class SharedProcessTunnelService extends Disposable implements ISharedPro
return
{
id
};
}
async
startTunnel
(
id
:
string
,
tunnelRemoteHost
:
string
,
tunnelRemotePort
:
number
,
tunnelLocalPort
:
number
|
undefined
,
elevateIfNeeded
:
boolean
|
undefined
):
Promise
<
ISharedProcessTunnel
>
{
async
startTunnel
(
authority
:
string
,
id
:
string
,
tunnelRemoteHost
:
string
,
tunnelRemotePort
:
number
,
tunnelLocalPort
:
number
|
undefined
,
elevateIfNeeded
:
boolean
|
undefined
):
Promise
<
ISharedProcessTunnel
>
{
const
tunnelData
=
new
TunnelData
();
const
tunnel
=
await
Promise
.
resolve
(
this
.
_tunnelService
.
openTunnel
(
tunnelData
,
tunnelRemoteHost
,
tunnelRemotePort
,
tunnelLocalPort
,
elevateIfNeeded
));
const
tunnel
=
await
Promise
.
resolve
(
this
.
_tunnelService
.
openTunnel
(
authority
,
tunnelData
,
tunnelRemoteHost
,
tunnelRemotePort
,
tunnelLocalPort
,
elevateIfNeeded
));
if
(
!
tunnel
)
{
this
.
_logService
.
info
(
`[SharedProcessTunnelService] Could not create a tunnel to
${
tunnelRemoteHost
}
:
${
tunnelRemotePort
}
(remote).`
);
tunnelData
.
dispose
();
...
...
src/vs/platform/remote/node/tunnelService.ts
浏览文件 @
ec64531d
...
...
@@ -14,7 +14,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
connectRemoteAgentTunnel
,
IAddressProvider
,
IConnectionOptions
,
ISocketFactory
}
from
'
vs/platform/remote/common/remoteAgentConnection
'
;
import
{
AbstractTunnelService
,
isAllInterfaces
,
isLocalhost
,
RemoteTunnel
,
TunnelPrivacyId
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
AbstractTunnelService
,
isAllInterfaces
,
ISharedTunnelsService
as
ISharedTunnelsService
,
isLocalhost
,
ITunnelService
,
RemoteTunnel
,
TunnelPrivacyId
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
ISignService
}
from
'
vs/platform/sign/common/sign
'
;
async
function
createRemoteTunnel
(
options
:
IConnectionOptions
,
defaultTunnelHost
:
string
,
tunnelRemoteHost
:
string
,
tunnelRemotePort
:
number
,
tunnelLocalPort
?:
number
):
Promise
<
RemoteTunnel
>
{
...
...
@@ -189,3 +189,33 @@ export class TunnelService extends BaseTunnelService {
super
(
nodeSocketFactory
,
logService
,
signService
,
productService
,
configurationService
);
}
}
export
class
SharedTunnelsService
extends
Disposable
implements
ISharedTunnelsService
{
declare
readonly
_serviceBrand
:
undefined
;
private
readonly
_tunnelServices
:
Map
<
string
,
ITunnelService
>
=
new
Map
();
public
constructor
(
@
ILogService
protected
readonly
logService
:
ILogService
,
@
IProductService
private
readonly
productService
:
IProductService
,
@
ISignService
private
readonly
signService
:
ISignService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
)
{
super
();
}
async
openTunnel
(
authority
:
string
,
addressProvider
:
IAddressProvider
|
undefined
,
remoteHost
:
string
|
undefined
,
remotePort
:
number
,
localPort
?:
number
,
elevateIfNeeded
?:
boolean
,
privacy
?:
string
,
protocol
?:
string
):
Promise
<
RemoteTunnel
|
undefined
>
{
this
.
logService
.
trace
(
`ForwardedPorts: (SharedTunnelService) openTunnel request for
${
remoteHost
}
:
${
remotePort
}
on local port
${
localPort
}
.`
);
if
(
!
this
.
_tunnelServices
.
has
(
authority
))
{
const
tunnelService
=
new
TunnelService
(
this
.
logService
,
this
.
signService
,
this
.
productService
,
this
.
configurationService
);
this
.
_register
(
tunnelService
);
this
.
_tunnelServices
.
set
(
authority
,
tunnelService
);
tunnelService
.
onTunnelClosed
(
async
()
=>
{
if
((
await
tunnelService
.
tunnels
).
length
===
0
)
{
tunnelService
.
dispose
();
this
.
_tunnelServices
.
delete
(
authority
);
}
});
}
return
this
.
_tunnelServices
.
get
(
authority
)
!
.
openTunnel
(
addressProvider
,
remoteHost
,
remotePort
,
localPort
,
elevateIfNeeded
,
privacy
,
protocol
);
}
}
src/vs/workbench/services/remote/electron-sandbox/tunnelServiceImpl.ts
浏览文件 @
ec64531d
...
...
@@ -92,8 +92,8 @@ export class TunnelService extends AbstractTunnelService {
private
async
_createSharedProcessTunnel
(
addressProvider
:
IAddressProvider
,
tunnelRemoteHost
:
string
,
tunnelRemotePort
:
number
,
tunnelLocalPort
:
number
|
undefined
,
elevateIfNeeded
:
boolean
|
undefined
):
Promise
<
RemoteTunnel
>
{
const
{
id
}
=
await
this
.
_sharedProcessTunnelService
.
createTunnel
();
this
.
_activeSharedProcessTunnels
.
add
(
id
);
const
result
=
await
this
.
_sharedProcessTunnelService
.
startTunnel
(
id
,
tunnelRemoteHost
,
tunnelRemotePort
,
tunnelLocalPort
,
elevateIfNeeded
);
const
authority
=
this
.
_environmentService
.
remoteAuthority
!
;
const
result
=
await
this
.
_sharedProcessTunnelService
.
startTunnel
(
authority
,
id
,
tunnelRemoteHost
,
tunnelRemotePort
,
tunnelLocalPort
,
elevateIfNeeded
);
const
tunnel
=
this
.
_instantiationService
.
createInstance
(
SharedProcessTunnel
,
id
,
addressProvider
,
tunnelRemoteHost
,
tunnelRemotePort
,
result
.
tunnelLocalPort
,
result
.
localAddress
,
()
=>
{
this
.
_activeSharedProcessTunnels
.
delete
(
id
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录