public cCommand(sCommandDetails pCommandDetails) { Tag = pCommandDetails.Tag ?? throw new ArgumentOutOfRangeException(nameof(pCommandDetails)); mParts = pCommandDetails.Parts ?? throw new ArgumentOutOfRangeException(nameof(pCommandDetails)); mDisposables = pCommandDetails.Disposables ?? throw new ArgumentOutOfRangeException(nameof(pCommandDetails)); mSASLAuthentication = mDisposables.SASLAuthentication; UIDValidity = pCommandDetails.UIDValidity; Hook = pCommandDetails.Hook ?? throw new ArgumentOutOfRangeException(nameof(pCommandDetails)); }
public async Task <cCommandResult> ExecuteAsync(cMethodControl pMC, sCommandDetails pCommandDetails, cTrace.cContext pParentContext) { var lContext = pParentContext.NewMethod(nameof(cCommandPipeline), nameof(ExecuteAsync), pMC, pCommandDetails); if (mDisposed) { pCommandDetails.Disposables?.Dispose(); throw new ObjectDisposedException(nameof(cCommandPipeline)); } if (mState < eState.connected) { pCommandDetails.Disposables?.Dispose(); throw new InvalidOperationException(kInvalidOperationExceptionMessage.NotConnected); } cCommand lCommand; lock (mPipelineLock) { if (mState == eState.stopped) { pCommandDetails.Disposables.Dispose(); throw mBackgroundTaskException; } lCommand = new cCommand(pCommandDetails); mQueuedCommands.Enqueue(lCommand); mBackgroundReleaser.Release(lContext); } try { return(await lCommand.WaitAsync(pMC, lContext).ConfigureAwait(false)); } finally { lock (mPipelineLock) { if (lCommand.State == eCommandState.queued) { lCommand.SetComplete(lContext); } } } }