From bcda95353e52949e39f3198958452a61672183ef Mon Sep 17 00:00:00 2001 From: Tim Seaward Date: Thu, 21 Sep 2017 11:30:05 +0100 Subject: [PATCH] Remove extra span (#922) --- .../Internal/Formatters/BinaryMessageParser.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Formatters/BinaryMessageParser.cs b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Formatters/BinaryMessageParser.cs index e730528a9f..341763c5ce 100644 --- a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Formatters/BinaryMessageParser.cs +++ b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Formatters/BinaryMessageParser.cs @@ -26,21 +26,18 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Formatters throw new FormatException("Messages over 2GB in size are not supported"); } - // Skip over the length - var remaining = buffer.Slice(sizeof(long)); - // We don't have enough data - while (remaining.Length < (int)length) + if (buffer.Length < (int)length + sizeof(long)) { return false; } // Get the payload - payload = remaining.Slice(0, (int)length); + payload = buffer.Slice(sizeof(long), (int)length); // Skip the payload - buffer = remaining.Slice((int)length); + buffer = buffer.Slice((int)length + sizeof(long)); return true; } } -} +} \ No newline at end of file