Helios.Channels.DefaultChannelHandlerInvoker.InvokeWriteAsync C# (CSharp) Method

InvokeWriteAsync() public method

public InvokeWriteAsync ( IChannelHandlerContext ctx, object msg ) : Task
ctx IChannelHandlerContext
msg object
return Task
        public Task InvokeWriteAsync(IChannelHandlerContext ctx, object msg)
        {
            Contract.Requires(msg != null);
            // todo: check for cancellation
            //if (!validatePromise(ctx, promise, false)) {
            //    // promise cancelled
            //    return;
            //}

            if (Executor.InEventLoop)
            {
                return ChannelHandlerInvokerUtil.InvokeWriteAsyncNow(ctx, msg);
            }
            else
            {
                var promise = new TaskCompletionSource();
                this.SafeExecuteOutbound(WriteTask.NewInstance(ctx, msg, promise), promise, msg);
                return promise.Task;
            }
        }