Merge branch 'benaadams/peek' into dev
This commit is contained in:
commit
0f389f01cb
|
|
@ -92,28 +92,22 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
|
||||||
|
|
||||||
public int Peek()
|
public int Peek()
|
||||||
{
|
{
|
||||||
if (_block == null)
|
var block = _block;
|
||||||
{
|
if (block == null)
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (_index < _block.End)
|
|
||||||
{
|
|
||||||
return _block.Array[_index];
|
|
||||||
}
|
|
||||||
else if (_block.Next == null)
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var block = _block.Next;
|
var index = _index;
|
||||||
var index = block.Start;
|
|
||||||
while (true)
|
if (index < block.End)
|
||||||
{
|
{
|
||||||
if (index < block.End)
|
return block.Array[index];
|
||||||
{
|
}
|
||||||
return block.Array[index];
|
|
||||||
}
|
do
|
||||||
else if (block.Next == null)
|
{
|
||||||
|
if (block.Next == null)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +116,12 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
|
||||||
block = block.Next;
|
block = block.Next;
|
||||||
index = block.Start;
|
index = block.Start;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (index < block.End)
|
||||||
|
{
|
||||||
|
return block.Array[index];
|
||||||
|
}
|
||||||
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe long PeekLong()
|
public unsafe long PeekLong()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue