mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkReader/WriterPool: .pool renamed to .Pool
This commit is contained in:
parent
409eac092d
commit
73d95f9b5b
@ -21,7 +21,7 @@ public static class NetworkReaderPool
|
||||
// reuse Pool<T>
|
||||
// we still wrap it in NetworkReaderPool.Get/Recyle so we can reset the
|
||||
// position and array before reusing.
|
||||
static readonly Pool<PooledNetworkReader> pool = new Pool<PooledNetworkReader>(
|
||||
static readonly Pool<PooledNetworkReader> Pool = new Pool<PooledNetworkReader>(
|
||||
// byte[] will be assigned in GetReader
|
||||
() => new PooledNetworkReader(new byte[]{})
|
||||
);
|
||||
@ -33,7 +33,7 @@ public static class NetworkReaderPool
|
||||
public static PooledNetworkReader GetReader(byte[] bytes)
|
||||
{
|
||||
// grab from pool & set buffer
|
||||
PooledNetworkReader reader = pool.Take();
|
||||
PooledNetworkReader reader = Pool.Take();
|
||||
reader.buffer = new ArraySegment<byte>(bytes);
|
||||
reader.Position = 0;
|
||||
return reader;
|
||||
@ -46,7 +46,7 @@ public static PooledNetworkReader GetReader(byte[] bytes)
|
||||
public static PooledNetworkReader GetReader(ArraySegment<byte> segment)
|
||||
{
|
||||
// grab from pool & set buffer
|
||||
PooledNetworkReader reader = pool.Take();
|
||||
PooledNetworkReader reader = Pool.Take();
|
||||
reader.buffer = segment;
|
||||
reader.Position = 0;
|
||||
return reader;
|
||||
@ -58,7 +58,7 @@ public static PooledNetworkReader GetReader(ArraySegment<byte> segment)
|
||||
/// </summary>
|
||||
public static void Recycle(PooledNetworkReader reader)
|
||||
{
|
||||
pool.Return(reader);
|
||||
Pool.Return(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public static class NetworkWriterPool
|
||||
// position before reusing.
|
||||
// this is also more consistent with NetworkReaderPool where we need to
|
||||
// assign the internal buffer before reusing.
|
||||
static readonly Pool<PooledNetworkWriter> pool = new Pool<PooledNetworkWriter>(
|
||||
static readonly Pool<PooledNetworkWriter> Pool = new Pool<PooledNetworkWriter>(
|
||||
() => new PooledNetworkWriter()
|
||||
);
|
||||
|
||||
@ -32,7 +32,7 @@ public static class NetworkWriterPool
|
||||
public static PooledNetworkWriter GetWriter()
|
||||
{
|
||||
// grab from pool & reset position
|
||||
PooledNetworkWriter writer = pool.Take();
|
||||
PooledNetworkWriter writer = Pool.Take();
|
||||
writer.Reset();
|
||||
return writer;
|
||||
}
|
||||
@ -43,7 +43,7 @@ public static PooledNetworkWriter GetWriter()
|
||||
/// </summary>
|
||||
public static void Recycle(PooledNetworkWriter writer)
|
||||
{
|
||||
pool.Return(writer);
|
||||
Pool.Return(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user