private void WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken) { using (var helper = new WaitForDescriptionChangedHelper(this, selector, description, descriptionChangedTask, timeout, cancellationToken)) { var index = Task.WaitAny(helper.Tasks); helper.HandleCompletedTask(helper.Tasks[index]); } }
private async Task WaitForDescriptionChangedAsync(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken) { using (var helper = new WaitForDescriptionChangedHelper(this, selector, description, descriptionChangedTask, timeout, cancellationToken)) { var completedTask = await Task.WhenAny(helper.Tasks).ConfigureAwait(false); helper.HandleCompletedTask(completedTask); } }