Ejemplo n.º 1
0
        public void Init(int maxBufferSize, int bucketCount)
        {
            MaxArraySize = maxBufferSize;
            BucketCount  = bucketCount;

            Pool = System.Buffers.ArrayPool <byte> .Create(MaxArraySize, BucketCount);
        }
Ejemplo n.º 2
0
 private void UDP_UDPCall(System.Buffers.ArrayPool <byte> pool, byte[] data, int len, SocketRsp rsp)
 {
     byte[] tmp = new byte[len];
     Array.Copy(data, 0, tmp, 0, tmp.Length);
     pool.Return(data);
     Process(tmp, rsp);
 }
Ejemplo n.º 3
0
        public InternalConnectionFactory(IConnectionParameters parameters)
#endif
        {
            _parameters = parameters;
#if ENABLE_ARRAY_POOL
            _arrayPool = arrayPool;
#endif
        }
Ejemplo n.º 4
0
        public InternalConnectionFactory(IConnectionParameters parameters, RemoteCertificateValidationCallback userCertificateValidationCallback)
#endif
        {
            _parameters = parameters;
            _userCertificateValidationCallback = userCertificateValidationCallback ?? UserCertificateValidationCallback;

#if ENABLE_ARRAY_POOL
            _arrayPool = arrayPool;
#endif
        }
        public TokenSendStream(Stream innerStream, DbEnvironment environment)
#endif
        {
            _innerStream            = innerStream;
            _innerWriteBufferStream = new MemoryStream();
            _environment            = environment;
            _isDisposed             = false;
#if ENABLE_ARRAY_POOL
            _arrayPool = arrayPool;
#endif
        }
Ejemplo n.º 6
0
        public InternalConnection(IConnectionParameters parameters, Stream networkStream, ITokenReader reader, DbEnvironment environment)
#endif
        {
            _parameters                = parameters;
            _networkStream             = networkStream;
            _reader                    = reader;
            _environment               = environment;
            _environment.PacketSize    = parameters.PacketSize; //server might decide to change the packet size later anyway
            _environment.UseAseDecimal = parameters.UseAseDecimal;
            _sendMutex                 = new object();
#if ENABLE_ARRAY_POOL
            _arrayPool = arrayPool;
#endif
        }
        public TokenReceiveStream(Stream innerStream, DbEnvironment environment)
#endif
        {
            _innerStream            = innerStream;
            _environment            = environment;
            _headerReadBufferLength = environment.HeaderSize;
#if ENABLE_ARRAY_POOL
            _arrayPool        = arrayPool;
            _headerReadBuffer = arrayPool.Rent(_headerReadBufferLength);
            _bodyReadBuffer   = arrayPool.Rent(_environment.PacketSize - _headerReadBufferLength);
#else
            _headerReadBuffer = new byte[_headerReadBufferLength];
            _bodyReadBuffer   = new byte[_environment.PacketSize - _headerReadBufferLength];
#endif
            _bodyReadBufferPosition = 0;
            _bodyReadBufferLength   = 0;
            IsCancelled             = false;
            _isDisposed             = false;
            _readBufferHasBytes     = false;
            _innerStreamHasBytes    = true;
        }
Ejemplo n.º 8
0
        public void Remove_NeightbourRegion(RegionVO region)
        {
            int countForRemove = Helper_GetCountNeighbour(region);

            if (countForRemove > 0)
            {
                int lenght = this.NeighbourRegions.Length;

                System.Buffers.ArrayPool <RegionVO> pool = System.Buffers.ArrayPool <RegionVO> .Shared;

                RegionVO[] newNeighbours = new RegionVO[this.NeighbourRegions.Length - countForRemove];
                int        newNIndex     = 0;
                for (int i = 0; i < lenght; i++)
                {
                    if (this.NeighbourRegions[i] != region)
                    {
                        newNeighbours[newNIndex] = this.NeighbourRegions[i];
                        newNIndex++;
                    }
                }

                this.NeighbourRegions = newNeighbours;
            }
        }
 public HttpResponseStreamWriter(System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize, System.Buffers.ArrayPool <byte> bytePool, System.Buffers.ArrayPool <char> charPool)
 {
 }
 public FormReader(string data, System.Buffers.ArrayPool <char> charPool)
 {
 }
 public BufferedReadStream(System.IO.Stream inner, int bufferSize, System.Buffers.ArrayPool <byte> bytePool)
 {
 }
Ejemplo n.º 12
0
 public FileBufferingReadStream(System.IO.Stream inner, int memoryThreshold, System.Nullable <long> bufferLimit, System.Func <string> tempFileDirectoryAccessor, System.Buffers.ArrayPool <byte> bytePool)
 {
 }
 public NewtonsoftJsonOutputFormatter(Newtonsoft.Json.JsonSerializerSettings serializerSettings, System.Buffers.ArrayPool <char> charPool)
 {
 }
Ejemplo n.º 14
0
 public InternalConnectionFactory(IConnectionParameters parameters, System.Buffers.ArrayPool <byte> arrayPool, RemoteCertificateValidationCallback userCertificateValidationCallback)
 public TokenReceiveStream(Stream innerStream, DbEnvironment environment, System.Buffers.ArrayPool <byte> arrayPool)
 public PagedByteBuffer(System.Buffers.ArrayPool <byte> arrayPool)
 {
 }
Ejemplo n.º 17
0
 public BufferedReadStream(System.IO.Stream inner, int bufferSize, System.Buffers.ArrayPool <System.Byte> bytePool) => throw null;
Ejemplo n.º 18
0
 public InternalConnectionFactory(IConnectionParameters parameters, System.Buffers.ArrayPool <byte> arrayPool)
Ejemplo n.º 19
0
 public FormReader(string data, System.Buffers.ArrayPool <System.Char> charPool) => throw null;
Ejemplo n.º 20
0
 public InternalConnection(IConnectionParameters parameters, Stream networkStream, ITokenReader reader, DbEnvironment environment, System.Buffers.ArrayPool <byte> arrayPool)
Ejemplo n.º 21
0
 public FileBufferingReadStream(System.IO.Stream inner, int memoryThreshold, System.Int64?bufferLimit, string tempFileDirectory, System.Buffers.ArrayPool <System.Byte> bytePool) => throw null;
 public FileBufferingReadStream(System.IO.Stream inner, int memoryThreshold, long?bufferLimit, string tempFileDirectory, System.Buffers.ArrayPool <byte> bytePool)
 {
 }
 public NewtonsoftJsonInputFormatter(Microsoft.Extensions.Logging.ILogger logger, Newtonsoft.Json.JsonSerializerSettings serializerSettings, System.Buffers.ArrayPool <char> charPool, Microsoft.Extensions.ObjectPool.ObjectPoolProvider objectPoolProvider, Microsoft.AspNetCore.Mvc.MvcOptions options, Microsoft.AspNetCore.Mvc.MvcNewtonsoftJsonOptions jsonOptions)
 {
 }
 public FormReader(System.IO.Stream stream, System.Text.Encoding encoding, System.Buffers.ArrayPool <char> charPool)
 {
 }
 public NewtonsoftJsonOutputFormatter(Newtonsoft.Json.JsonSerializerSettings serializerSettings, System.Buffers.ArrayPool <char> charPool, Microsoft.AspNetCore.Mvc.MvcOptions mvcOptions)
 {
 }
 public HttpRequestStreamReader(System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize, System.Buffers.ArrayPool <byte> bytePool, System.Buffers.ArrayPool <char> charPool)
 {
 }
Ejemplo n.º 27
0
 private void TcpServer_CallSrv(System.Buffers.ArrayPool <byte> pool, byte[] data, int len, SocketRsp rsp)
 {
     //接收组播信息
     NodeListener.Instance.Process(data, len);
     pool.Return(data);
 }
 public static System.Threading.Tasks.Task DrainAsync(this System.IO.Stream stream, System.Buffers.ArrayPool <byte> bytePool, long?limit, System.Threading.CancellationToken cancellationToken)
 {
     throw null;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Allocates buffer space used by the buffer pool
 /// </summary>
 public void InitBuffer()
 {
     Pool = System.Buffers.ArrayPool <byte> .Create(MaxArraySize, BucketCount);
 }