protected virtual void Dispose(bool disposing) { if (disposing && !disposed) { disposed = true; // Cancel all pending requests (if any). Note that we don't call CancelPendingRequests() but cancel // the CTS directly. The reason is that CancelPendingRequests() would cancel the current CTS and create // a new CTS. We don't want a new CTS in this case. pendingRequestsCts.Cancel(); // If we used a user-defined channel, dispose that channel. If no channel was specified, dispose the // default channel. if (userChannel != null) { userChannel.Dispose(); } else { if (actualChannel != null) { actualChannel.Dispose(); } } } }
protected override void Dispose(bool disposing) { if (disposing) { innerChannel.Dispose(); } base.Dispose(disposing); }