@@ -111,6 +111,7 @@ namespace sio
111
111
m_auth = auth;
112
112
113
113
this ->reset_states ();
114
+ m_abort_retries = false ;
114
115
m_client.get_io_service ().dispatch (std::bind (&client_impl::connect_impl,this ,uri,m_query_string));
115
116
m_network_thread.reset (new thread (std::bind (&client_impl::run_loop,this )));// uri lifecycle?
116
117
@@ -149,13 +150,15 @@ namespace sio
149
150
void client_impl::close ()
150
151
{
151
152
m_con_state = con_closing;
153
+ m_abort_retries = true ;
152
154
this ->sockets_invoke_void (&sio::socket::close );
153
155
m_client.get_io_service ().dispatch (std::bind (&client_impl::close_impl, this ,close ::status::normal ," End by user" ));
154
156
}
155
157
156
158
void client_impl::sync_close ()
157
159
{
158
160
m_con_state = con_closing;
161
+ m_abort_retries = true ;
159
162
this ->sockets_invoke_void (&sio::socket::close );
160
163
m_client.get_io_service ().dispatch (std::bind (&client_impl::close_impl, this ,close ::status::normal ," End by user" ));
161
164
if (m_network_thread)
@@ -375,7 +378,7 @@ namespace sio
375
378
m_con_state = con_closed;
376
379
this ->sockets_invoke_void (&sio::socket::on_disconnect);
377
380
LOG (" Connection failed." << endl);
378
- if (m_reconn_made<m_reconn_attempts)
381
+ if (m_reconn_made<m_reconn_attempts && !m_abort_retries )
379
382
{
380
383
LOG (" Reconnect for attempt:" <<m_reconn_made<<endl);
381
384
unsigned delay = this ->next_delay ();
@@ -439,7 +442,7 @@ namespace sio
439
442
else
440
443
{
441
444
this ->sockets_invoke_void (&sio::socket::on_disconnect);
442
- if (m_reconn_made<m_reconn_attempts)
445
+ if (m_reconn_made<m_reconn_attempts && !m_abort_retries )
443
446
{
444
447
LOG (" Reconnect for attempt:" <<m_reconn_made<<endl);
445
448
unsigned delay = this ->next_delay ();
0 commit comments