mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 08:24:08 +01:00
opm: properly close listeners after disabling proxy scan
This commit is contained in:
parent
8275e2700d
commit
1661e3656d
1 changed files with 21 additions and 1 deletions
|
@ -438,6 +438,8 @@ opm_cancel(struct auth_client *auth)
|
|||
{
|
||||
rb_dlink_node *ptr, *nptr;
|
||||
|
||||
notice_client(auth->cid, "*** Did not detect open proxies");
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head)
|
||||
{
|
||||
struct opm_scan *scan = ptr->data;
|
||||
|
@ -469,7 +471,25 @@ static void
|
|||
set_opm_enabled(const char *key __unused, int parc __unused, const char **parv)
|
||||
{
|
||||
if(listeners[LISTEN_IPV4].F != NULL || listeners[LISTEN_IPV6].F != NULL)
|
||||
opm_enable = (*parv[0] == '1');
|
||||
{
|
||||
if(!(opm_enable = (*parv[0] == '1')))
|
||||
{
|
||||
struct auth_client *auth;
|
||||
rb_dictionary_iter iter;
|
||||
|
||||
/* Close the listening socket */
|
||||
if(listeners[LISTEN_IPV4].F != NULL)
|
||||
rb_close(listeners[LISTEN_IPV4].F);
|
||||
|
||||
if(listeners[LISTEN_IPV6].F != NULL)
|
||||
rb_close(listeners[LISTEN_IPV6].F);
|
||||
|
||||
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
|
||||
{
|
||||
opm_cancel(auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
/* No listener, no point... */
|
||||
opm_enable = false;
|
||||
|
|
Loading…
Reference in a new issue