public void SetIdleConfiguration(cIdleConfiguration pConfiguration, cTrace.cContext pParentContext) { var lContext = pParentContext.NewMethod(nameof(cCommandPipeline), nameof(SetIdleConfiguration), pConfiguration); if (mDisposed) { throw new ObjectDisposedException(nameof(cCommandPipeline)); } mIdleConfiguration = pConfiguration; mBackgroundReleaser.Release(lContext); }
private async Task ZIdleAsync(cIdleConfiguration pIdleConfiguration, cTrace.cContext pParentContext) { var lContext = pParentContext.NewMethod(nameof(cCommandPipeline), nameof(ZIdleAsync)); if (!await ZIdleDelayAsync(pIdleConfiguration.StartDelay, lContext).ConfigureAwait(false)) { return; } if (mIdleCommandSupported) { await ZIdleIdleAsync(pIdleConfiguration.IdleRestartInterval, lContext).ConfigureAwait(false); } else { await ZIdlePollAsync(pIdleConfiguration.PollInterval, lContext).ConfigureAwait(false); } }
public cCommandPipeline(cCallbackSynchroniser pSynchroniser, Action <cTrace.cContext> pDisconnected, cBatchSizerConfiguration pNetworkWriteConfiguration, cIdleConfiguration pIdleConfiguration, cTrace.cContext pParentContext) { var lContext = pParentContext.NewObject(nameof(cCommandPipeline), pIdleConfiguration); mSynchroniser = pSynchroniser ?? throw new ArgumentNullException(nameof(pSynchroniser)); mDisconnected = pDisconnected ?? throw new ArgumentNullException(nameof(pDisconnected)); if (pNetworkWriteConfiguration == null) { throw new ArgumentNullException(nameof(pNetworkWriteConfiguration)); } mConnection = new cConnection(pNetworkWriteConfiguration); mIdleConfiguration = pIdleConfiguration; mResponseTextProcessor = new cResponseTextProcessor(pSynchroniser); // these depend on the cancellationtokensource being constructed mBackgroundReleaser = new cReleaser("commandpipeline_background", mBackgroundCancellationTokenSource.Token); mBackgroundAwaiter = new cAwaiter(mBackgroundCancellationTokenSource.Token); mBackgroundSendBuffer = new cSendBuffer(pSynchroniser, mConnection, mBackgroundCancellationTokenSource.Token); // plumbing mIdleBlock.Released += mBackgroundReleaser.Release; // when the idle block is removed, kick the background process }
// (note for when adding more: they need to be disposed) public cSession(cCallbackSynchroniser pSynchroniser, fCapabilities pIgnoreCapabilities, fMailboxCacheDataItems pMailboxCacheDataItems, cBatchSizerConfiguration pNetworkWriteConfiguration, cIdleConfiguration pIdleConfiguration, cBatchSizerConfiguration pFetchCacheItemsConfiguration, cBatchSizerConfiguration pFetchBodyReadConfiguration, Encoding pEncoding, cTrace.cContext pParentContext) { var lContext = pParentContext.NewObject(nameof(cSession), pIgnoreCapabilities, pMailboxCacheDataItems, pNetworkWriteConfiguration, pIdleConfiguration, pFetchCacheItemsConfiguration, pFetchBodyReadConfiguration); mSynchroniser = pSynchroniser ?? throw new ArgumentNullException(nameof(pSynchroniser)); mIgnoreCapabilities = pIgnoreCapabilities; mMailboxCacheDataItems = pMailboxCacheDataItems; mPipeline = new cCommandPipeline(pSynchroniser, ZDisconnected, pNetworkWriteConfiguration, pIdleConfiguration, lContext); mFetchCacheItemsSizer = new cBatchSizer(pFetchCacheItemsConfiguration); mFetchBodyReadSizer = new cBatchSizer(pFetchBodyReadConfiguration); mCommandPartFactory = new cCommandPartFactory(false, null); if (pEncoding == null) { mEncodingPartFactory = mCommandPartFactory; } else { mEncodingPartFactory = new cCommandPartFactory(false, pEncoding); } }
public void SetIdleConfiguration(cIdleConfiguration pConfiguration, cTrace.cContext pParentContext) { var lContext = pParentContext.NewMethod(nameof(cSession), nameof(SetIdleConfiguration), pConfiguration); mPipeline.SetIdleConfiguration(pConfiguration, lContext); }