Skip to content

Consider all client-initiated closes to be close_reason_normal. #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2017
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