Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/internal/sio_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down