Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
14bb2fdc
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,发现更多精彩内容 >>
提交
14bb2fdc
编写于
1月 07, 2021
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tunnels from a tunnel factory can have async dispose
上级
a84603f4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
21 addition
and
19 deletion
+21
-19
src/vs/platform/remote/common/tunnel.ts
src/vs/platform/remote/common/tunnel.ts
+7
-7
src/vs/platform/remote/node/tunnelService.ts
src/vs/platform/remote/node/tunnelService.ts
+1
-1
src/vs/platform/webview/common/webviewPortMapping.ts
src/vs/platform/webview/common/webviewPortMapping.ts
+2
-2
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-1
src/vs/workbench/api/browser/mainThreadTunnelService.ts
src/vs/workbench/api/browser/mainThreadTunnelService.ts
+2
-2
src/vs/workbench/api/node/extHostTunnelService.ts
src/vs/workbench/api/node/extHostTunnelService.ts
+4
-4
src/vs/workbench/contrib/remote/common/tunnelFactory.ts
src/vs/workbench/contrib/remote/common/tunnelFactory.ts
+1
-1
src/vs/workbench/workbench.web.api.ts
src/vs/workbench/workbench.web.api.ts
+3
-1
未找到文件。
src/vs/platform/remote/common/tunnel.ts
浏览文件 @
14bb2fdc
...
...
@@ -17,7 +17,7 @@ export interface RemoteTunnel {
readonly
tunnelRemoteHost
:
string
;
readonly
tunnelLocalPort
?:
number
;
readonly
localAddress
:
string
;
dispose
(
silent
?:
boolean
):
void
;
dispose
(
silent
?:
boolean
):
Promise
<
void
>
;
}
export
interface
TunnelOptions
{
...
...
@@ -119,10 +119,10 @@ export abstract class AbstractTunnelService implements ITunnelService {
});
}
dispose
():
void
{
async
dispose
():
Promise
<
void
>
{
for
(
const
portMap
of
this
.
_tunnels
.
values
())
{
for
(
const
{
value
}
of
portMap
.
values
())
{
value
.
then
(
tunnel
=>
tunnel
?.
dispose
());
await
value
.
then
(
tunnel
=>
tunnel
?.
dispose
());
}
portMap
.
clear
();
}
...
...
@@ -163,13 +163,13 @@ export abstract class AbstractTunnelService implements ITunnelService {
tunnelRemoteHost
:
tunnel
.
tunnelRemoteHost
,
tunnelLocalPort
:
tunnel
.
tunnelLocalPort
,
localAddress
:
tunnel
.
localAddress
,
dispose
:
()
=>
{
dispose
:
async
()
=>
{
const
existingHost
=
this
.
_tunnels
.
get
(
tunnel
.
tunnelRemoteHost
);
if
(
existingHost
)
{
const
existing
=
existingHost
.
get
(
tunnel
.
tunnelRemotePort
);
if
(
existing
)
{
existing
.
refcount
--
;
this
.
tryDisposeTunnel
(
tunnel
.
tunnelRemoteHost
,
tunnel
.
tunnelRemotePort
,
existing
);
await
this
.
tryDisposeTunnel
(
tunnel
.
tunnelRemoteHost
,
tunnel
.
tunnelRemotePort
,
existing
);
}
}
}
...
...
@@ -178,9 +178,9 @@ export abstract class AbstractTunnelService implements ITunnelService {
private
async
tryDisposeTunnel
(
remoteHost
:
string
,
remotePort
:
number
,
tunnel
:
{
refcount
:
number
,
readonly
value
:
Promise
<
RemoteTunnel
|
undefined
>
}):
Promise
<
void
>
{
if
(
tunnel
.
refcount
<=
0
)
{
const
disposePromise
:
Promise
<
void
>
=
tunnel
.
value
.
then
(
tunnel
=>
{
const
disposePromise
:
Promise
<
void
>
=
tunnel
.
value
.
then
(
async
(
tunnel
)
=>
{
if
(
tunnel
)
{
tunnel
.
dispose
(
true
);
await
tunnel
.
dispose
(
true
);
this
.
_onTunnelClosed
.
fire
({
host
:
tunnel
.
tunnelRemoteHost
,
port
:
tunnel
.
tunnelRemotePort
});
}
});
...
...
src/vs/platform/remote/node/tunnelService.ts
浏览文件 @
14bb2fdc
...
...
@@ -57,7 +57,7 @@ class NodeRemoteTunnel extends Disposable implements RemoteTunnel {
this
.
tunnelRemoteHost
=
tunnelRemoteHost
;
}
public
dispose
():
void
{
public
async
dispose
():
Promise
<
void
>
{
super
.
dispose
();
this
.
_server
.
removeListener
(
'
listening
'
,
this
.
_listeningListener
);
this
.
_server
.
removeListener
(
'
connection
'
,
this
.
_connectionListener
);
...
...
src/vs/platform/webview/common/webviewPortMapping.ts
浏览文件 @
14bb2fdc
...
...
@@ -60,9 +60,9 @@ export class WebviewPortMappingManager implements IDisposable {
return
undefined
;
}
dispose
()
{
async
dispose
()
{
for
(
const
tunnel
of
this
.
_tunnels
.
values
())
{
tunnel
.
dispose
();
await
tunnel
.
dispose
();
}
this
.
_tunnels
.
clear
();
}
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
14bb2fdc
...
...
@@ -189,7 +189,7 @@ declare module 'vscode' {
export
interface
Tunnel
extends
TunnelDescription
{
// Implementers of Tunnel should fire onDidDispose when dispose is called.
onDidDispose
:
Event
<
void
>
;
dispose
():
void
;
dispose
():
void
|
Thenable
<
void
>
;
}
/**
...
...
src/vs/workbench/api/browser/mainThreadTunnelService.ts
浏览文件 @
14bb2fdc
...
...
@@ -66,8 +66,8 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
tunnelRemoteHost
:
tunnel
.
remoteAddress
.
host
,
localAddress
:
typeof
tunnel
.
localAddress
===
'
string
'
?
tunnel
.
localAddress
:
makeAddress
(
tunnel
.
localAddress
.
host
,
tunnel
.
localAddress
.
port
),
tunnelLocalPort
:
typeof
tunnel
.
localAddress
!==
'
string
'
?
tunnel
.
localAddress
.
port
:
undefined
,
dispose
:
(
silent
?:
boolean
)
=>
{
this
.
_proxy
.
$closeTunnel
({
host
:
tunnel
.
remoteAddress
.
host
,
port
:
tunnel
.
remoteAddress
.
port
},
silent
);
dispose
:
async
(
silent
?:
boolean
)
=>
{
return
this
.
_proxy
.
$closeTunnel
({
host
:
tunnel
.
remoteAddress
.
host
,
port
:
tunnel
.
remoteAddress
.
port
},
silent
);
}
};
});
...
...
src/vs/workbench/api/node/extHostTunnelService.ts
浏览文件 @
14bb2fdc
...
...
@@ -30,11 +30,11 @@ class ExtensionTunnel implements vscode.Tunnel {
constructor
(
public
readonly
remoteAddress
:
{
port
:
number
,
host
:
string
},
public
readonly
localAddress
:
{
port
:
number
,
host
:
string
}
|
string
,
private
readonly
_dispose
:
()
=>
void
)
{
}
private
readonly
_dispose
:
()
=>
Promise
<
void
>
)
{
}
dispose
():
void
{
dispose
():
Promise
<
void
>
{
this
.
_onDispose
.
fire
();
this
.
_dispose
();
return
this
.
_dispose
();
}
}
...
...
@@ -212,7 +212,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
if
(
silent
)
{
hostMap
.
get
(
remote
.
port
)
!
.
disposeListener
.
dispose
();
}
hostMap
.
get
(
remote
.
port
)
!
.
tunnel
.
dispose
();
await
hostMap
.
get
(
remote
.
port
)
!
.
tunnel
.
dispose
();
hostMap
.
delete
(
remote
.
port
);
}
}
...
...
src/vs/workbench/contrib/remote/common/tunnelFactory.ts
浏览文件 @
14bb2fdc
...
...
@@ -36,7 +36,7 @@ export class TunnelFactoryContribution extends Disposable implements IWorkbenchC
// The tunnel factory may give us an inaccessible local address.
// To make sure this doesn't happen, resolve the uri immediately.
localAddress
:
(
await
openerService
.
resolveExternalUri
(
URI
.
parse
(
localAddress
))).
resolved
.
toString
(),
dispose
:
tunnel
.
dispose
dispose
:
async
()
=>
{
await
tunnel
.
dispose
;
}
};
resolve
(
remoteTunnel
);
});
...
...
src/vs/workbench/workbench.web.api.ts
浏览文件 @
14bb2fdc
...
...
@@ -73,7 +73,7 @@ export interface TunnelCreationOptions {
elevationRequired
?:
boolean
;
}
interface
ITunnel
extends
IDisposable
{
interface
ITunnel
{
remoteAddress
:
{
port
:
number
,
host
:
string
};
/**
...
...
@@ -85,6 +85,8 @@ interface ITunnel extends IDisposable {
* Implementers of Tunnel should fire onDidDispose when dispose is called.
*/
onDidDispose
:
Event
<
void
>
;
dispose
():
Promise
<
void
>
|
void
;
}
interface
IShowPortCandidate
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录