mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-09 13:23:12 +02:00
+- Added /stats P on listener info (oper-only)
+- listener temporary stuff works now
This commit is contained in:
@@ -198,3 +198,5 @@
|
||||
- Fixed a bunch of possible bugs in newconf
|
||||
- Added sendto_realops logging of config errors
|
||||
- Made /rehash work .. sortof. Fixed some crash bugs
|
||||
- Added /stats P on listener info (oper-only)
|
||||
- listener temporary stuff works now
|
||||
|
||||
@@ -77,7 +77,6 @@ void initlists()
|
||||
bzero((char *)&servs, sizeof(servs));
|
||||
bzero((char *)&links, sizeof(links));
|
||||
bzero((char *)&classs, sizeof(classs));
|
||||
// bzero((char *)&aconfs, sizeof(aconfs));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+22
-11
@@ -1957,6 +1957,26 @@ void run_configuration(void)
|
||||
}
|
||||
}
|
||||
|
||||
void listen_cleanup()
|
||||
{
|
||||
int i = 0;
|
||||
ConfigItem_listen *listen_ptr;
|
||||
ConfigItem t;
|
||||
for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)listen_ptr->next)
|
||||
{
|
||||
if (listen_ptr->flag.temporary && !listen_ptr->clients)
|
||||
{
|
||||
ircfree(listen_ptr->ip);
|
||||
t.next = del_ConfigItem((ConfigItem *) listen_ptr, (ConfigItem **)&conf_listen);
|
||||
MyFree(listen_ptr);
|
||||
listen_ptr = (ConfigItem_listen *) &t;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i)
|
||||
close_listeners();
|
||||
}
|
||||
|
||||
int rehash(cptr, sptr, sig)
|
||||
aClient *cptr, *sptr;
|
||||
int sig;
|
||||
@@ -2083,17 +2103,8 @@ int rehash(cptr, sptr, sig)
|
||||
init_conf2("unrealircd.conf");
|
||||
/* Clean up listen records */
|
||||
close_listeners();
|
||||
for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)listen_ptr->next)
|
||||
{
|
||||
if (listen_ptr->flag.temporary)
|
||||
{
|
||||
ircfree(listen_ptr->ip);
|
||||
t.next = del_ConfigItem((ConfigItem *) listen_ptr, (ConfigItem **)&conf_listen);
|
||||
MyFree(listen_ptr);
|
||||
listen_ptr = (ConfigItem_listen *) &t;
|
||||
|
||||
}
|
||||
}
|
||||
listen_cleanup();
|
||||
run_configuration();
|
||||
check_pings(TStime(), 1);
|
||||
sendto_realops("Completed rehash");
|
||||
}
|
||||
|
||||
+11
-1
@@ -429,6 +429,7 @@ int exit_client(cptr, sptr, from, comment)
|
||||
#ifdef FNAME_USERLOG
|
||||
time_t on_for;
|
||||
#endif
|
||||
ConfigItem_listen *listen_conf;
|
||||
static char comment1[HOSTLEN + HOSTLEN + 2];
|
||||
static int recurse = 0;
|
||||
|
||||
@@ -452,7 +453,16 @@ int exit_client(cptr, sptr, from, comment)
|
||||
|
||||
if (sptr->listener)
|
||||
if (sptr->listener->class)
|
||||
((ConfigItem_listen *)sptr->listener->class)->clients--;
|
||||
{
|
||||
listen_conf = (ConfigItem_listen *) sptr->listener->class;
|
||||
listen_conf->clients--;
|
||||
if (listen_conf->flag.temporary
|
||||
&& (listen_conf->clients == 0))
|
||||
{
|
||||
/* Call listen cleanup */
|
||||
listen_cleanup();
|
||||
}
|
||||
}
|
||||
sptr->flags |= FLAGS_CLOSING;
|
||||
if (IsPerson(sptr))
|
||||
{
|
||||
|
||||
@@ -2576,6 +2576,24 @@ int m_stats(cptr, sptr, parc, parv)
|
||||
}
|
||||
if (SHOWOPERS == 1)
|
||||
break;
|
||||
case 'P':
|
||||
if (IsOper(sptr))
|
||||
{
|
||||
for (i = 0; i <= highest_fd; i++)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (!IsListening(acptr))
|
||||
continue;
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** Listener on %s:%i, clients %i. is %s",
|
||||
me.name, sptr->name,
|
||||
((ConfigItem_listen *)acptr->class)->ip,
|
||||
((ConfigItem_listen *)acptr->class)->port,
|
||||
((ConfigItem_listen *)acptr->class)->clients,
|
||||
((ConfigItem_listen *)acptr->class)->flag.temporary ? "TEMPORARY" : "PERM");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
{
|
||||
ConfigItem_ban *bans;
|
||||
|
||||
Reference in New Issue
Block a user