mirror of
https://github.com/socketio/socket.io-client-cpp.git
synced 2026-05-06 14:02:56 +00:00
Consider all client-initiated closes to be close_reason_normal.
If any errors occur while closing, such as TLS Short Read, we don't want to reconnect if we had initiated the close.
This commit is contained in:
parent
725a8e0e17
commit
29468bfbd2
@ -406,6 +406,7 @@ namespace sio
|
||||
void client_impl::on_close(connection_hdl con)
|
||||
{
|
||||
LOG("Client Disconnected." << endl);
|
||||
con_state m_con_state_was = m_con_state;
|
||||
m_con_state = con_closed;
|
||||
lib::error_code ec;
|
||||
close::status::value code = close::status::normal;
|
||||
@ -421,7 +422,11 @@ namespace sio
|
||||
m_con.reset();
|
||||
this->clear_timers();
|
||||
client::close_reason reason;
|
||||
if(code == close::status::normal)
|
||||
|
||||
// If we initiated the close, no matter what the close status was,
|
||||
// we'll consider it a normal close. (When using TLS, we can
|
||||
// sometimes get a TLS Short Read error when closing.)
|
||||
if(code == close::status::normal || m_con_state_was == con_closing)
|
||||
{
|
||||
this->sockets_invoke_void(&sio::socket::on_disconnect);
|
||||
reason = client::close_reason_normal;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user