You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When client disconnects, chat server doesn't remove session_ptr from m_connections (chat.cpp, line #79):
send_to_all(encode_message("server",m_connections[client]+" has left the chat."));
this makes server crazy, after sending messages from other clients.
The following logic should fix this:
std::cout << "client " << client << " left the lobby." << std::endl;
const std::string alias = it->second;
m_connections.erase(it);
// send user list and signoff message to all clients
send_to_all(serialize_state());
send_to_all(encode_message("server", alias+" has left the chat."));
The text was updated successfully, but these errors were encountered:
When client disconnects, chat server doesn't remove
session_ptr
fromm_connections
(chat.cpp, line #79):this makes server crazy, after sending messages from other clients.
The following logic should fix this:
The text was updated successfully, but these errors were encountered: