From 5aea7292cdafedb8e02516d55cf733d124d7cc6d Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Tue, 25 Apr 2017 15:18:47 -0700 Subject: [PATCH] prevent websocket deadlock (#419) --- test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs | 4 +--- test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs index c67d18d8d1..8b733dd154 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs @@ -1,11 +1,9 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO.Pipelines; using System.Threading.Tasks; using Microsoft.AspNetCore.Sockets; - namespace Microsoft.AspNetCore.SignalR.Tests { public class EchoEndPoint : EndPoint diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs index 98d36334e2..1347c3afd2 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs @@ -92,6 +92,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests try { var receiveTcs = new TaskCompletionSource(); + var closeTcs = new TaskCompletionSource(); connection.Received += (data, format) => { logger.LogInformation("Received {length} byte message", data.Length); @@ -108,6 +109,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests { receiveTcs.TrySetResult(null); } + closeTcs.TrySetResult(null); }; logger.LogInformation("Starting connection to {url}", url); @@ -124,6 +126,8 @@ namespace Microsoft.AspNetCore.SignalR.Tests logger.LogInformation("Receiving message"); Assert.Equal(message, await receiveTcs.Task.OrTimeout()); logger.LogInformation("Completed receive"); + + await closeTcs.Task.OrTimeout(); } finally {