Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2a5268ea
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a5268ea
编写于
8月 23, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use a connection instead of a keepalivesession.
上级
d361d733
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
39 deletion
+21
-39
src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs
...sualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs
+21
-39
未找到文件。
src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs
浏览文件 @
2a5268ea
...
...
@@ -41,7 +41,6 @@ private enum GlobalNotificationState
private
readonly
object
_globalNotificationsGate
=
new
object
();
private
Task
<
GlobalNotificationState
>
_globalNotificationsTask
=
Task
.
FromResult
(
GlobalNotificationState
.
NotStarted
);
private
KeepAliveSession
_keepAliveSession
;
public
static
async
Task
<
RemoteHostClient
>
CreateAsync
(
Workspace
workspace
,
CancellationToken
cancellationToken
)
...
...
@@ -188,21 +187,10 @@ private void UnregisterGlobalOperationNotifications()
lock
(
_globalNotificationsGate
)
{
_globalNotificationsTask
=
_globalNotificationsTask
.
ContinueWith
(
continuation
,
CancellationToken
.
None
,
TaskContinuationOptions
.
None
,
TaskScheduler
.
Default
);
}
GlobalNotificationState
continuation
(
Task
<
GlobalNotificationState
>
previousTask
)
{
if
(
_keepAliveSession
!=
null
)
{
_keepAliveSession
.
Shutdown
();
_keepAliveSession
=
null
;
}
// Unilaterally transition us to the finished state. Once we're finished
// we cannot start or stop anymore.
return
GlobalNotificationState
.
Finished
;
_globalNotificationsTask
=
_globalNotificationsTask
.
ContinueWith
(
_
=>
GlobalNotificationState
.
Finished
,
CancellationToken
.
None
,
TaskContinuationOptions
.
None
,
TaskScheduler
.
Default
);
}
}
...
...
@@ -223,16 +211,20 @@ async Task<GlobalNotificationState> continuation(Task<GlobalNotificationState> p
return
previousTask
.
Result
;
}
var
session
=
await
GetOrCreateKeepAliveSessionAsync
().
ConfigureAwait
(
false
);
if
(
session
!=
null
)
using
(
var
connection
=
await
this
.
TryCreateConnectionAsync
(
WellKnownRemoteHostServices
.
RemoteHostService
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
await
session
.
TryInvokeAsync
(
nameof
(
IRemoteHostService
.
OnGlobalOperationStarted
),
new
object
[]
{
""
},
CancellationToken
.
None
).
ConfigureAwait
(
false
);
if
(
connection
!=
null
)
{
await
connection
.
InvokeAsync
(
nameof
(
IRemoteHostService
.
OnGlobalOperationStarted
),
new
object
[]
{
""
},
CancellationToken
.
None
).
ConfigureAwait
(
false
);
return
GlobalNotificationState
.
Started
;
}
}
return
GlobalNotificationState
.
Started
;
return
GlobalNotificationState
.
Not
Started
;
}
}
...
...
@@ -254,14 +246,15 @@ async Task<GlobalNotificationState> continuation(Task<GlobalNotificationState> p
return
previousTask
.
Result
;
}
// Only process a stop if we heard about a previous start.
var
session
=
await
GetOrCreateKeepAliveSessionAsync
().
ConfigureAwait
(
false
);
if
(
session
!=
null
)
using
(
var
connection
=
await
this
.
TryCreateConnectionAsync
(
WellKnownRemoteHostServices
.
RemoteHostService
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
await
session
.
TryInvokeAsync
(
nameof
(
IRemoteHostService
.
OnGlobalOperationStopped
),
new
object
[]
{
e
.
Operations
,
e
.
Cancelled
},
CancellationToken
.
None
).
ConfigureAwait
(
false
);
if
(
connection
!=
null
)
{
await
connection
.
InvokeAsync
(
nameof
(
IRemoteHostService
.
OnGlobalOperationStopped
),
new
object
[]
{
e
.
Operations
,
e
.
Cancelled
},
CancellationToken
.
None
).
ConfigureAwait
(
false
);
}
}
// Mark that we're stopped now.
...
...
@@ -269,17 +262,6 @@ async Task<GlobalNotificationState> continuation(Task<GlobalNotificationState> p
}
}
private
async
Task
<
KeepAliveSession
>
GetOrCreateKeepAliveSessionAsync
()
{
if
(
_keepAliveSession
==
null
)
{
_keepAliveSession
=
await
this
.
TryCreateKeepAliveSessionAsync
(
WellKnownRemoteHostServices
.
RemoteHostService
,
CancellationToken
.
None
).
ConfigureAwait
(
false
);
}
return
_keepAliveSession
;
}
private
void
OnRpcDisconnected
(
object
sender
,
JsonRpcDisconnectedEventArgs
e
)
{
Stopped
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录