Handle socket errors from connected clients.

If a TLS error occurs, it could end up in a situation where the network handler code did not want to
read or write because it only had the error flag set. However, this was not handled, which left the
socket triggering in the event loop - but nothing was done to handle it.

This can easily cause a 100% cpu situation - the hub is still functioning though while this is
happening.
This commit is contained in:
Jan Vidar Krey 2019-12-13 10:51:25 +01:00
parent cff10910ad
commit 35d8088b44
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,12 @@ void net_event(struct net_connection* con, int event, void *arg)
LOG_TRACE("net_event() : fd=%d, ev=%d, arg=%p", con->sd, (int) event, arg);
#endif
if (event == NET_EVENT_ERROR)
{
hub_disconnect_user(user->hub, user, quit_socket_error);
return;
}
if (event == NET_EVENT_TIMEOUT)
{
if (user_is_connecting(user))