提交 c020fe86 编写于 作者: S Sam Harwell

Wait for GetAssetsAsync before returning

上级 ebb674f4
......@@ -59,7 +59,7 @@ public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checks
// (non-contiguous) memory allocated for the underlying buffers. The amount of memory is bounded by the total size of the serialized assets.
var localPipe = new Pipe(RemoteHostAssetSerialization.PipeOptionsWithUnlimitedWriterBuffer);
Task.Run(() =>
var task1 = Task.Run(() =>
{
try
{
......@@ -71,12 +71,14 @@ public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checks
{
// no-op
}
}, cancellationToken).Forget();
}, cancellationToken);
// Complete RPC once we send the initial piece of data and start waiting for the writer to send more,
// so the client can start reading from the stream. Once CopyPipeDataAsync completes the pipeWriter
// the corresponding client-side pipeReader will complete and the data transfer will be finished.
CopyPipeDataAsync().Forget();
var task2 = CopyPipeDataAsync();
await Task.WhenAll(task1, task2).ConfigureAwait(false);
async Task CopyPipeDataAsync()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册