Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Current package versions:

## Unreleased
- TLS certificate/`TrustIssuer`: Check EKU in X509 chain checks when validating cerificates ([#2670 by NickCraver](https://github.com/StackExchange/StackExchange.Redis/pull/2670))
- Fix [#2679](https://github.com/StackExchange/StackExchange.Redis/issues/2679) - blocking call in long-running connects ([#2680 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2680))

## 2.7.33

Expand Down
12 changes: 10 additions & 2 deletions src/StackExchange.Redis/ConnectionMultiplexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,17 @@ private static ConnectionMultiplexer ConnectImpl(ConfigurationOptions configurat
// note that task has timeouts internally, so it might take *just over* the regular timeout
var task = muxer.ReconfigureAsync(first: true, reconfigureAll: false, log, null, "connect");

if (!task.Wait(muxer.SyncConnectTimeout(true)))
if (task.Wait(muxer.SyncConnectTimeout(true)))
{
// completed promptly - we can check the outcome; hard failures
// (such as password problems) should be reported promptly - it
// won't magically start working
if (!task.Result) throw ExceptionFactory.UnableToConnect(muxer, muxer.failureMessage);
}
else
{
// incomplete - most likely slow initial connection; optionally
// allow a soft failure mode
task.ObserveErrors();
if (muxer.RawConfig.AbortOnConnectFail)
{
Expand All @@ -720,7 +729,6 @@ private static ConnectionMultiplexer ConnectImpl(ConfigurationOptions configurat
}
}

if (!task.Result) throw ExceptionFactory.UnableToConnect(muxer, muxer.failureMessage);
killMe = null;
Interlocked.Increment(ref muxer._connectCompletedCount);

Expand Down