pid_t pid;
rb_dlink_list readq;
rb_dlink_list writeq;
+ uint8_t shutdown;
uint8_t dead;
};
static int ssld_wait = 0;
+void
+restart_ssld(void)
+{
+ rb_dlink_node *ptr, *next;
+ ssl_ctl_t *ctl;
+
+ RB_DLINK_FOREACH_SAFE(ptr, next, ssl_daemons.head)
+ {
+ ctl = ptr->data;
+ if(ctl->dead)
+ continue;
+ if(ctl->shutdown)
+ continue;
+ ctl->shutdown = 1;
+ ssld_count--;
+ if(!ctl->cli_count)
+ {
+ rb_kill(ctl->pid, SIGKILL);
+ free_ssl_daemon(ctl);
+ }
+ }
+
+ start_ssldaemon(ServerInfo.ssld_count, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list);
+}
+
static void
ssl_killall(void)
{
if(ctl->dead)
continue;
ctl->dead = 1;
- ssld_count--;
+ if(!ctl->shutdown)
+ ssld_count--;
rb_kill(ctl->pid, SIGKILL);
+ if(!ctl->cli_count)
+ free_ssl_daemon(ctl);
}
}
return;
ctl->dead = 1;
- ssld_count--;
rb_kill(ctl->pid, SIGKILL); /* make sure the process is really gone */
- ilog(L_MAIN, "ssld helper died - attempting to restart");
- sendto_realops_snomask(SNO_GENERAL, L_ALL, "ssld helper died - attempting to restart");
- start_ssldaemon(1, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list);
+
+ if(!ctl->shutdown)
+ {
+ ssld_count--;
+ ilog(L_MAIN, "ssld helper died - attempting to restart");
+ sendto_realops_snomask(SNO_GENERAL, L_ALL, "ssld helper died - attempting to restart");
+ start_ssldaemon(1, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list);
+ }
}
static void
ctl = ptr->data;
if(ctl->dead)
continue;
+ if(ctl->shutdown)
+ continue;
if(lowest == NULL)
{
lowest = ctl;
return;
ctl->cli_count--;
+ if(ctl->shutdown && !ctl->cli_count)
+ {
+ ctl->dead = 1;
+ rb_kill(ctl->pid, SIGKILL);
+ }
if(ctl->dead && !ctl->cli_count)
{
free_ssl_daemon(ctl);
return ssld_count;
}
+void
+ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_status status), void *data)
+{
+ rb_dlink_node *ptr, *next;
+ ssl_ctl_t *ctl;
+ RB_DLINK_FOREACH_SAFE(ptr, next, ssl_daemons.head)
+ {
+ ctl = ptr->data;
+ func(data, ctl->pid, ctl->cli_count,
+ ctl->dead ? SSLD_DEAD :
+ (ctl->shutdown ? SSLD_SHUTDOWN : SSLD_ACTIVE));
+ }
+}
+
void
init_ssld(void)
{