@@ -40,7 +40,7 @@ namespace signalr
4040 : m_connection(connection_impl::create(url, trace_level, log_writer,
4141 http_client_factory, websocket_factory, skip_negotiation)), m_logger(log_writer, trace_level),
4242 m_callback_manager (" connection went out of scope before invocation result was received" ),
43- m_handshakeReceived(false ), m_disconnected([]() noexcept {}), m_protocol(std::unique_ptr<json_hub_protocol>(new json_hub_protocol()))
43+ m_handshakeReceived(false ), m_disconnected([](std::exception_ptr ) noexcept {}), m_protocol(std::unique_ptr<json_hub_protocol>(new json_hub_protocol()))
4444 {}
4545
4646 void hub_connection_impl::initialize ()
@@ -57,7 +57,7 @@ namespace signalr
5757 }
5858 });
5959
60- m_connection->set_disconnected ([weak_hub_connection]()
60+ m_connection->set_disconnected ([weak_hub_connection](std::exception_ptr exception )
6161 {
6262 auto connection = weak_hub_connection.lock ();
6363 if (connection)
@@ -67,7 +67,7 @@ namespace signalr
6767
6868 connection->m_callback_manager .clear (" connection was stopped before invocation result was received" );
6969
70- connection->m_disconnected ();
70+ connection->m_disconnected (exception );
7171 }
7272 });
7373 }
@@ -120,7 +120,7 @@ namespace signalr
120120
121121 if (start_exception)
122122 {
123- connection->m_connection ->stop ([start_exception, callback, weak_connection](std::exception_ptr)
123+ connection->m_connection ->stop ([callback, weak_connection](std::exception_ptr ex )
124124 {
125125 try
126126 {
@@ -133,8 +133,8 @@ namespace signalr
133133 }
134134 catch (...) {}
135135
136- callback (start_exception );
137- });
136+ callback (ex );
137+ }, start_exception );
138138 return ;
139139 }
140140
@@ -167,7 +167,7 @@ namespace signalr
167167 connection->m_connection ->stop ([callback, handshake_exception](std::exception_ptr)
168168 {
169169 callback (handshake_exception);
170- });
170+ }, nullptr );
171171 }
172172 });
173173 });
@@ -218,7 +218,7 @@ namespace signalr
218218 {
219219 callback (exception);
220220 }
221- });
221+ }, nullptr );
222222 }
223223 }
224224
@@ -318,7 +318,7 @@ namespace signalr
318318 }
319319
320320 // TODO: Consider passing "reason" exception to stop
321- m_connection->stop ([](std::exception_ptr) {});
321+ m_connection->stop ([](std::exception_ptr) {}, std::current_exception () );
322322 }
323323 }
324324
@@ -419,7 +419,7 @@ namespace signalr
419419 m_connection->set_client_config (config);
420420 }
421421
422- void hub_connection_impl::set_disconnected (const std::function<void ()>& disconnected)
422+ void hub_connection_impl::set_disconnected (const std::function<void (std::exception_ptr )>& disconnected)
423423 {
424424 m_disconnected = disconnected;
425425 }
0 commit comments