Skip to content

Commit a8797a3

Browse files
committed
CSHARP-1961: Fix bug in connection state transition.
1 parent 2894c3d commit a8797a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MongoDB.Driver.Core/Core/Connections/BinaryConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2013-2016 MongoDB Inc.
1+
/* Copyright 2013-2017 MongoDB Inc.
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -152,7 +152,7 @@ public ConnectionSettings Settings
152152
// methods
153153
private void ConnectionFailed(Exception exception)
154154
{
155-
if (!_state.TryChange(State.Open, State.Failed))
155+
if (!_state.TryChange(State.Open, State.Failed) && !_state.TryChange(State.Initializing, State.Failed))
156156
{
157157
var currentState = _state.Value;
158158
if (currentState != State.Failed && currentState != State.Disposed)

0 commit comments

Comments
 (0)