Properly delete listener socket events on shutdown.
This commit is contained in:
parent
6ea1dfc995
commit
d8dea8091f
1 changed files with 7 additions and 0 deletions
|
@ -537,6 +537,11 @@ bool setup_myself(void)
|
||||||
|
|
||||||
memcpy(&listen_socket[listen_sockets].sa, aip->ai_addr, aip->ai_addrlen);
|
memcpy(&listen_socket[listen_sockets].sa, aip->ai_addr, aip->ai_addrlen);
|
||||||
listen_sockets++;
|
listen_sockets++;
|
||||||
|
|
||||||
|
if(listen_sockets >= MAXSOCKETS) {
|
||||||
|
logger(LOG_WARNING, _("Maximum of %d listening sockets reached"), MAXSOCKETS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
@ -623,6 +628,8 @@ void close_network_connections(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < listen_sockets; i++) {
|
for(i = 0; i < listen_sockets; i++) {
|
||||||
|
event_del(&listen_socket[i].ev_tcp);
|
||||||
|
event_del(&listen_socket[i].ev_udp);
|
||||||
close(listen_socket[i].tcp);
|
close(listen_socket[i].tcp);
|
||||||
close(listen_socket[i].udp);
|
close(listen_socket[i].udp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue