Remove extra span (#922)

This commit is contained in:
Tim Seaward 2017-09-21 11:30:05 +01:00 committed by David Fowler
parent f71e31a1cd
commit bcda95353e
1 changed files with 4 additions and 7 deletions

View File

@ -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;
}
}
}
}