Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e791b6c5
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e791b6c5
编写于
9月 20, 2019
作者:
A
Alexandru Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a message that would reduce the grace time
上级
54c3db12
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
23 deletion
+33
-23
src/vs/base/parts/ipc/common/ipc.net.ts
src/vs/base/parts/ipc/common/ipc.net.ts
+4
-0
src/vs/workbench/services/extensions/common/extensionHostProtocol.ts
...bench/services/extensions/common/extensionHostProtocol.ts
+5
-1
src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
...nch/services/extensions/node/extensionHostProcessSetup.ts
+24
-22
未找到文件。
src/vs/base/parts/ipc/common/ipc.net.ts
浏览文件 @
e791b6c5
...
...
@@ -150,6 +150,10 @@ export const enum ProtocolConstants {
* If there is no reconnection within this time-frame, consider the connection permanently closed...
*/
ReconnectionGraceTime
=
3
*
60
*
60
*
1000
,
// 3hrs
/**
* Maximal grace time between the first and the last reconnection...
*/
ReconnectionShortGraceTime
=
5
*
60
*
1000
,
// 5min
}
class
ProtocolMessage
{
...
...
src/vs/workbench/services/extensions/common/extensionHostProtocol.ts
浏览文件 @
e791b6c5
...
...
@@ -15,6 +15,10 @@ export interface IExtHostSocketMessage {
skipWebSocketFrames
:
boolean
;
}
export
interface
IExtHostReduceGraceTimeMessage
{
type
:
'
VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME
'
;
}
export
const
enum
MessageType
{
Initialized
,
Ready
,
...
...
@@ -44,4 +48,4 @@ export function isMessageOfType(message: VSBuffer, type: MessageType): boolean {
case
3
:
return
type
===
MessageType
.
Terminate
;
default
:
return
false
;
}
}
\ No newline at end of file
}
src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
浏览文件 @
e791b6c5
...
...
@@ -13,7 +13,7 @@ import { PersistentProtocol, ProtocolConstants, BufferedEmitter } from 'vs/base/
import
{
NodeSocket
,
WebSocketNodeSocket
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
product
from
'
vs/platform/product/common/product
'
;
import
{
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MessageType
,
createMessageOfType
,
isMessageOfType
,
IExtHostSocketMessage
,
IExtHostReadyMessage
}
from
'
vs/workbench/services/extensions/common/extensionHostProtocol
'
;
import
{
MessageType
,
createMessageOfType
,
isMessageOfType
,
IExtHostSocketMessage
,
IExtHostReadyMessage
,
IExtHostReduceGraceTimeMessage
}
from
'
vs/workbench/services/extensions/common/extensionHostProtocol
'
;
import
{
ExtensionHostMain
,
IExitFn
}
from
'
vs/workbench/services/extensions/common/extensionHostMain
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
IURITransformer
,
URITransformer
,
IRawURITransformer
}
from
'
vs/base/common/uriIpc
'
;
...
...
@@ -21,6 +21,7 @@ import { exists } from 'vs/base/node/pfs';
import
{
realpath
}
from
'
vs/base/node/extpath
'
;
import
{
IHostUtils
}
from
'
vs/workbench/api/common/extHostExtensionService
'
;
import
'
vs/workbench/api/node/extHost.services
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
interface
ParsedExtHostArgs
{
uriTransformerPath
?:
string
;
...
...
@@ -91,9 +92,12 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
reject
(
new
Error
(
'
VSCODE_EXTHOST_IPC_SOCKET timeout
'
));
},
60000
);
let
disconnectWaitTimer
:
NodeJS
.
Timeout
|
null
=
null
;
const
reconnectionGraceTime
=
ProtocolConstants
.
ReconnectionGraceTime
;
const
reconnectionShortGraceTime
=
ProtocolConstants
.
ReconnectionShortGraceTime
;
const
disconnectRunner1
=
new
RunOnceScheduler
(()
=>
onTerminate
(),
reconnectionGraceTime
);
const
disconnectRunner2
=
new
RunOnceScheduler
(()
=>
onTerminate
(),
reconnectionShortGraceTime
);
process
.
on
(
'
message
'
,
(
msg
:
IExtHostSocketMessage
,
handle
:
net
.
Socket
)
=>
{
process
.
on
(
'
message
'
,
(
msg
:
IExtHostSocketMessage
|
IExtHostReduceGraceTimeMessage
,
handle
:
net
.
Socket
)
=>
{
if
(
msg
&&
msg
.
type
===
'
VSCODE_EXTHOST_IPC_SOCKET
'
)
{
const
initialDataChunk
=
VSBuffer
.
wrap
(
Buffer
.
from
(
msg
.
initialDataChunk
,
'
base64
'
));
let
socket
:
NodeSocket
|
WebSocketNodeSocket
;
...
...
@@ -104,10 +108,8 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
}
if
(
protocol
)
{
// reconnection case
if
(
disconnectWaitTimer
)
{
clearTimeout
(
disconnectWaitTimer
);
disconnectWaitTimer
=
null
;
}
disconnectRunner1
.
cancel
();
disconnectRunner2
.
cancel
();
protocol
.
beginAcceptReconnection
(
socket
,
initialDataChunk
);
protocol
.
endAcceptReconnection
();
}
else
{
...
...
@@ -116,21 +118,21 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
protocol
.
onClose
(()
=>
onTerminate
());
resolve
(
protocol
);
if
(
msg
.
skipWebSocketFrames
)
{
// Wait for rich client to reconnect
protocol
.
onSocketClose
(()
=>
{
// The socket has closed, let's give the renderer a certain amount of time to reconnect
disconnectWaitTimer
=
setTimeout
(()
=>
{
disconnectWaitTimer
=
null
;
onTerminate
();
},
ProtocolConstants
.
ReconnectionGraceTime
);
});
}
else
{
// Do not wait for web companion to reconnect
protocol
.
onSocketClose
(()
=>
{
onTerminate
();
});
}
// Wait for rich client to reconnect
protocol
.
onSocketClose
(()
=>
{
// The socket has closed, let's give the renderer a certain amount of time to reconnect
disconnectRunner1
.
schedule
();
});
}
}
if
(
msg
&&
msg
.
type
===
'
VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME
'
)
{
if
(
disconnectRunner2
.
isScheduled
())
{
// we are disconnected and already running the short reconnection timer
return
;
}
if
(
disconnectRunner1
.
isScheduled
())
{
// we are disconnected and running the long reconnection timer
disconnectRunner2
.
schedule
();
}
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录