mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-12 15:17:14 +03:00
refactor: remove sideeffects from udp_timedout
This commit is contained in:
parent
c43882c85f
commit
7fb65ad0ac
@ -468,6 +468,7 @@ void udp_timeouts(struct select_info* fd_info)
|
||||
if (FD_ISSET(i, &fd_info->fds_r) || FD_ISSET(i, &fd_info->fds_w)) {
|
||||
struct connection* cnx = collection_get_cnx_from_fd(fd_info->collection, i);
|
||||
if (cnx && udp_timedout(cnx)) {
|
||||
close(cnx->target_sock);
|
||||
FD_CLR(i, &fd_info->fds_r);
|
||||
FD_CLR(i, &fd_info->fds_w);
|
||||
collection_remove_cnx(fd_info->collection, cnx);
|
||||
|
@ -137,9 +137,8 @@ int udp_timedout(struct connection* cnx)
|
||||
if (cnx->type != SOCK_DGRAM) return 0; /* Not a UDP connection */
|
||||
|
||||
if ((now - cnx->last_active > cnx->proto->udp_timeout)) {
|
||||
close(cnx->target_sock);
|
||||
if (cfg.verbose > 3)
|
||||
fprintf(stderr, "disconnect timed out UDP %d\n", cnx->target_sock);
|
||||
fprintf(stderr, "timed out UDP %d\n", cnx->target_sock);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user