public IoUringConnectionContext(LinuxSocket socket, EndPoint server, EndPoint client, MemoryPool <byte> pool, TransportThreadContext threadContext) { Socket = socket; LocalEndPoint = server; RemoteEndPoint = client; MemoryPool = pool; _threadContext = threadContext; var appScheduler = PipeScheduler.ThreadPool; // TODO: configure var inputOptions = new PipeOptions(MemoryPool, appScheduler, PipeScheduler.Inline, PauseInputWriterThreshold, PauseInputWriterThreshold / 2, useSynchronizationContext: false); var outputOptions = new PipeOptions(MemoryPool, PipeScheduler.Inline, appScheduler, PauseOutputWriterThreshold, PauseOutputWriterThreshold / 2, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(inputOptions, outputOptions); Transport = pair.Transport; Application = pair.Application; _onOnFlushedToApp = FlushedToAppAsynchronously; _onReadFromApp = ReadFromAppAsynchronously; iovec[] vecs = new iovec[ReadIOVecCount + WriteIOVecCount]; var handle = GCHandle.Alloc(vecs, GCHandleType.Pinned); _iovec = (iovec *)handle.AddrOfPinnedObject(); _iovecHandle = handle; }
public TransportThread(IPEndPoint endPoint, ChannelWriter <ConnectionContext> acceptQueue) { _ring = new Ring(RingSize); SetupEventFd(); _endPoint = endPoint; _acceptQueue = acceptQueue; _threadContext = new TransportThreadContext(_readPollQueue, _writePollQueue, _eventfd); }