mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ssld: provide version in stats S output
This commit is contained in:
parent
08e43ffb21
commit
e9ffc3c153
4 changed files with 26 additions and 6 deletions
|
@ -42,7 +42,7 @@ void start_zlib_session(void *data);
|
|||
void send_new_ssl_certs(const char *ssl_cert, const char *ssl_private_key, const char *ssl_dh_params, const char *ssl_cipher_list);
|
||||
void ssld_decrement_clicount(ssl_ctl_t *ctl);
|
||||
int get_ssld_count(void);
|
||||
void ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_status status), void *data);
|
||||
void ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_status status, const char *version), void *data);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ struct _ssl_ctl
|
|||
rb_dlink_list writeq;
|
||||
uint8_t shutdown;
|
||||
uint8_t dead;
|
||||
char version[256];
|
||||
};
|
||||
|
||||
static void send_new_ssl_certs_one(ssl_ctl_t * ctl, const char *ssl_cert,
|
||||
|
@ -479,8 +480,11 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl)
|
|||
static const char *no_ssl_or_zlib = "ssld has neither SSL/TLS or zlib support killing all sslds";
|
||||
rb_dlink_node *ptr, *next;
|
||||
ssl_ctl_buf_t *ctl_buf;
|
||||
int len;
|
||||
|
||||
if(ctl->dead)
|
||||
return;
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next, ctl->readq.head)
|
||||
{
|
||||
ctl_buf = ptr->data;
|
||||
|
@ -513,6 +517,11 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl)
|
|||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", no_ssl_or_zlib);
|
||||
ssl_killall();
|
||||
break;
|
||||
case 'V':
|
||||
len = ctl_buf->buflen - 1;
|
||||
if (len > sizeof(ctl->version) - 1)
|
||||
len = sizeof(ctl->version) - 1;
|
||||
strncpy(ctl->version, &ctl_buf->buf[1], len);
|
||||
case 'z':
|
||||
zlib_ok = 0;
|
||||
break;
|
||||
|
@ -938,7 +947,7 @@ get_ssld_count(void)
|
|||
}
|
||||
|
||||
void
|
||||
ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_status status), void *data)
|
||||
ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_status status, const char *version), void *data)
|
||||
{
|
||||
rb_dlink_node *ptr, *next;
|
||||
ssl_ctl_t *ctl;
|
||||
|
@ -947,7 +956,8 @@ ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_s
|
|||
ctl = ptr->data;
|
||||
func(data, ctl->pid, ctl->cli_count,
|
||||
ctl->dead ? SSLD_DEAD :
|
||||
(ctl->shutdown ? SSLD_SHUTDOWN : SSLD_ACTIVE));
|
||||
(ctl->shutdown ? SSLD_SHUTDOWN : SSLD_ACTIVE),
|
||||
ctl->version);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -889,15 +889,16 @@ stats_resv(struct Client *source_p)
|
|||
}
|
||||
|
||||
static void
|
||||
stats_ssld_foreach(void *data, pid_t pid, int cli_count, enum ssld_status status)
|
||||
stats_ssld_foreach(void *data, pid_t pid, int cli_count, enum ssld_status status, const char *version)
|
||||
{
|
||||
struct Client *source_p = data;
|
||||
|
||||
sendto_one_numeric(source_p, RPL_STATSDEBUG,
|
||||
"S :%u %c %u",
|
||||
"S :%u %c %u :%s",
|
||||
pid,
|
||||
status == SSLD_DEAD ? 'D' : (status == SSLD_SHUTDOWN ? 'S' : 'A'),
|
||||
cli_count);
|
||||
cli_count,
|
||||
version);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -973,6 +973,14 @@ send_i_am_useless(mod_ctl_t * ctl)
|
|||
mod_cmd_write_queue(ctl, useless, strlen(useless));
|
||||
}
|
||||
|
||||
static void
|
||||
send_version(mod_ctl_t * ctl)
|
||||
{
|
||||
char version[256] = { 'V', 0 };
|
||||
strncpy(&version[1], rb_lib_version(), sizeof(version) - 2);
|
||||
mod_cmd_write_queue(ctl, version, strlen(version));
|
||||
}
|
||||
|
||||
static void
|
||||
send_nozlib_support(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb)
|
||||
{
|
||||
|
@ -1242,6 +1250,7 @@ main(int argc, char **argv)
|
|||
rb_event_add("check_handshake_flood", check_handshake_flood, NULL, 10);
|
||||
read_pipe_ctl(mod_ctl->F_pipe, NULL);
|
||||
mod_read_ctl(mod_ctl->F, mod_ctl);
|
||||
send_version(mod_ctl);
|
||||
if(!zlib_ok && !ssl_ok)
|
||||
{
|
||||
/* this is really useless... */
|
||||
|
|
Loading…
Reference in a new issue