Skip to content

Commit ff3297b

Browse files
authored
Merge pull request #135 from ErisExchange/eris-more_reliable_close
Consider all client-initiated closes to be close_reason_normal.
2 parents 4d83a7a + 29468bf commit ff3297b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/internal/sio_client_impl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ namespace sio
399399
void client_impl::on_close(connection_hdl con)
400400
{
401401
LOG("Client Disconnected." << endl);
402+
con_state m_con_state_was = m_con_state;
402403
m_con_state = con_closed;
403404
lib::error_code ec;
404405
close::status::value code = close::status::normal;
@@ -414,7 +415,11 @@ namespace sio
414415
m_con.reset();
415416
this->clear_timers();
416417
client::close_reason reason;
417-
if(code == close::status::normal)
418+
419+
// If we initiated the close, no matter what the close status was,
420+
// we'll consider it a normal close. (When using TLS, we can
421+
// sometimes get a TLS Short Read error when closing.)
422+
if(code == close::status::normal || m_con_state_was == con_closing)
418423
{
419424
this->sockets_invoke_void(&sio::socket::on_disconnect);
420425
reason = client::close_reason_normal;

0 commit comments

Comments
 (0)