/// <inheritdoc/>
        public void Execute(IoEvent ioe)
        {
            Boolean offeredEvent = _queueHandler.Accept(this, ioe);

            if (offeredEvent)
            {
                Execute(() =>
                {
                    _queueHandler.Polled(this, ioe);
                    ioe.Fire();
                });

                _queueHandler.Offered(this, ioe);
            }
        }
Beispiel #2
0
        /// <inheritdoc/>
        public override void FilterWrite(INextFilter nextFilter, IoSession session, IWriteRequest writeRequest)
        {
            IoEvent ioe = new IoEvent(IoEventType.Write, session, writeRequest);

            if (_queueHandler.Accept(this, ioe))
            {
                nextFilter.FilterWrite(session, writeRequest);
                IWriteFuture writeFuture = writeRequest.Future;
                if (writeFuture == null)
                {
                    return;
                }

                // We can track the write request only when it has a future.
                _queueHandler.Offered(this, ioe);
                writeFuture.Complete += (s, e) => _queueHandler.Polled(this, ioe);
            }
        }