Beispiel #1
0
        public RegisteredSocketPipe(RegisteredMemoryPool pool, RegisteredSocket socket, long?maxSendBufferSize, long?maxReceiveBufferSize)
        {
            var state = new State(pool, socket, maxSendBufferSize, maxReceiveBufferSize);

            Input  = new Reader(state);
            Output = state;
        }
Beispiel #2
0
            public State(RegisteredMemoryPool pool, RegisteredSocket socket, long?maxSendBufferSize, long?maxReceiveBufferSize)
            {
                _pool   = pool;
                _socket = socket;

                int maxSendBytesQueuedActual = (int)Math.Clamp(maxSendBufferSize.GetValueOrDefault(), 512, int.MaxValue);

                _maxSendBytesQueued    = maxSendBytesQueuedActual;
                _resumeSendBytesQueued = maxSendBytesQueuedActual >> 1;

                int maxReceiveBytesQueuedActual = (int)Math.Clamp(maxReceiveBufferSize.GetValueOrDefault(), 512, int.MaxValue);

                _maxReceiveBytesAvailable    = maxReceiveBytesQueuedActual;
                _resumeReceiveBytesAvailable = maxReceiveBytesQueuedActual >> 2;
                _receiveSegmentLength        = maxReceiveBytesQueuedActual >> 2;
            }