Skip to content

Commit 5001569

Browse files
committed
HttpConnectionManager to use span based WebEncoders
1 parent 249b565 commit 5001569

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/SignalR/common/Http.Connections/src/Internal/HttpConnectionManager.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ public void RemoveConnection(string id)
105105

106106
private static string MakeNewConnectionId()
107107
{
108-
// TODO: Use Span when WebEncoders implements Span methods https://github.com/aspnet/Home/issues/2966
109108
// 128 bit buffer / 8 bits per byte = 16 bytes
110-
var buffer = new byte[16];
111-
_keyGenerator.GetBytes(buffer);
109+
Span<byte> buffer = stackalloc byte[16];
112110
// Generate the id with RNGCrypto because we want a cryptographically random id, which GUID is not
111+
_keyGenerator.GetBytes(buffer);
113112
return WebEncoders.Base64UrlEncode(buffer);
114113
}
115114

0 commit comments

Comments
 (0)