Skip to content

Commit 92f0003

Browse files
authored
fixed deadlock on Stop when in connecting state (aspnet#38)
1 parent 0f383af commit 92f0003

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/signalrclient/connection_impl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ namespace signalr
148148
if (redirect_count >= MAX_NEGOTIATE_REDIRECTS)
149149
{
150150
change_state(connection_state::disconnected);
151+
m_start_completed_event.cancel();
151152
callback(std::make_exception_ptr(signalr_exception("Negotiate redirection limit exceeded.")));
152153
return;
153154
}
@@ -178,13 +179,15 @@ namespace signalr
178179
.append(e.what()));
179180
}
180181
connection->change_state(connection_state::disconnected);
182+
connection->m_start_completed_event.cancel();
181183
callback(exception);
182184
return;
183185
}
184186

185187
if (!response.error.empty())
186188
{
187189
connection->change_state(connection_state::disconnected);
190+
connection->m_start_completed_event.cancel();
188191
callback(std::make_exception_ptr(signalr_exception(response.error)));
189192
return;
190193
}
@@ -219,6 +222,7 @@ namespace signalr
219222
if (!foundWebsockets)
220223
{
221224
connection->change_state(connection_state::disconnected);
225+
connection->m_start_completed_event.cancel();
222226
callback(std::make_exception_ptr(signalr_exception("The server does not support WebSockets which is currently the only transport supported by this client.")));
223227
return;
224228
}

0 commit comments

Comments
 (0)