Don't send WebSocketCloseStatus.Empty, it's invalid (#2716)
This commit is contained in:
parent
fd6b52c22b
commit
32d380a058
|
|
@ -118,10 +118,11 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
||||||
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
|
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
|
||||||
|
|
||||||
logger.LogInformation("Closing socket");
|
logger.LogInformation("Closing socket");
|
||||||
await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();
|
await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).OrTimeout();
|
||||||
logger.LogInformation("Waiting for close");
|
logger.LogInformation("Waiting for close");
|
||||||
result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
|
result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
|
||||||
Assert.Equal(WebSocketMessageType.Close, result.MessageType);
|
Assert.Equal(WebSocketMessageType.Close, result.MessageType);
|
||||||
|
Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
|
||||||
logger.LogInformation("Closed socket");
|
logger.LogInformation("Closed socket");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -156,10 +157,11 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
||||||
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
|
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
|
||||||
|
|
||||||
logger.LogInformation("Closing socket");
|
logger.LogInformation("Closing socket");
|
||||||
await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();
|
await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).OrTimeout();
|
||||||
logger.LogInformation("Waiting for close");
|
logger.LogInformation("Waiting for close");
|
||||||
result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
|
result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
|
||||||
Assert.Equal(WebSocketMessageType.Close, result.MessageType);
|
Assert.Equal(WebSocketMessageType.Close, result.MessageType);
|
||||||
|
Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
|
||||||
logger.LogInformation("Closed socket");
|
logger.LogInformation("Closed socket");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue