server.hpp | server.hpp | |||
---|---|---|---|---|
skipping to change at line 393 | skipping to change at line 393 | |||
template<typename selector_type> | template<typename selector_type> | |||
void basic_server<selector_type>::remove_client(const user* user) | void basic_server<selector_type>::remove_client(const user* user) | |||
{ | { | |||
// Emit part/disconnect signals | // Emit part/disconnect signals | |||
if(user->is_logged_in() ) | if(user->is_logged_in() ) | |||
on_part(*user); | on_part(*user); | |||
on_disconnect(*user); | on_disconnect(*user); | |||
// Store ID of client to remove | // Store ID of client to remove | |||
unsigned int user_id = user->get_id(); | unsigned int user_id = user->is_logged_in() ? user->get_id() : 0; | |||
// Remove user to prevent server from sending the packet to the | // Remove user to prevent server from sending the packet to the | |||
// user we are currently removing | // user we are currently removing | |||
basic_object<selector_type>::user_remove(user); | basic_object<selector_type>::user_remove(user); | |||
// Build packet for other clients | // Build packet for other clients | |||
if(user->is_logged_in() ) | if(user_id) | |||
{ | { | |||
packet pack("net6_client_part"); | packet pack("net6_client_part"); | |||
pack << user->get_id(); | pack << user_id; | |||
send(pack); | send(pack); | |||
} | } | |||
} | } | |||
template<typename selector_type> | template<typename selector_type> | |||
void basic_server<selector_type>::on_accept_event(tcp_server_socket& sock, | void basic_server<selector_type>::on_accept_event(tcp_server_socket& sock, | |||
io_condition io) | io_condition io) | |||
{ | { | |||
// Get selector from base class | // Get selector from base class | |||
selector_type& selector = basic_object<selector_type>::get_selector( ); | selector_type& selector = basic_object<selector_type>::get_selector( ); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||