NetworkReaderPool: use NetworkReader.SetBuffer

This commit is contained in:
vis2k 2021-06-09 21:13:30 +08:00
parent 854ea1e5a3
commit 2f5ce11491

View File

@ -28,8 +28,7 @@ public static PooledNetworkReader GetReader(byte[] bytes)
{
// grab from pool & set buffer
PooledNetworkReader reader = Pool.Take();
reader.buffer = new ArraySegment<byte>(bytes);
reader.Position = 0;
reader.SetBuffer(bytes);
return reader;
}
@ -38,8 +37,7 @@ public static PooledNetworkReader GetReader(ArraySegment<byte> segment)
{
// grab from pool & set buffer
PooledNetworkReader reader = Pool.Take();
reader.buffer = segment;
reader.Position = 0;
reader.SetBuffer(segment);
return reader;
}