public RegisteredSocketPipe(RegisteredMemoryPool pool, RegisteredSocket socket, long?maxSendBufferSize, long?maxReceiveBufferSize) { var state = new State(pool, socket, maxSendBufferSize, maxReceiveBufferSize); Input = new Reader(state); Output = state; }
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; }
internal RegisteredOperationContext(RegisteredSocket socket) { _socket = socket; _valueTaskSource.RunContinuationsAsynchronously = true; _buffers = new Interop.Rio.RIO_BUF[socket.ProtocolType == ProtocolType.Udp ? 2 : 1]; }