mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
apps/ocsp.c etc.: rename 'multi' to 'n_responders' for clarity
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/18434)
This commit is contained in:
parent
8aff29f020
commit
5e87fddc97
@ -125,7 +125,7 @@ int http_server_send_status(const char *prog, BIO *cbio,
|
||||
# endif
|
||||
|
||||
# ifdef HTTP_DAEMON
|
||||
extern int multi;
|
||||
extern int n_responders;
|
||||
extern int acfd;
|
||||
|
||||
void socket_timeout(int signum);
|
||||
|
@ -41,7 +41,7 @@ static int verbosity = LOG_INFO;
|
||||
|
||||
#ifdef HTTP_DAEMON
|
||||
|
||||
int multi = 0; /* run multiple responder processes, set by ocsp.c */
|
||||
int n_responders = 0; /* run multiple responder processes, set by ocsp.c */
|
||||
int acfd = (int) INVALID_SOCKET;
|
||||
|
||||
static int print_syslog(const char *str, size_t len, void *levPtr)
|
||||
@ -91,7 +91,7 @@ void trace_log_message(int category,
|
||||
return;
|
||||
}
|
||||
#ifdef HTTP_DAEMON
|
||||
if (multi != 0) {
|
||||
if (n_responders != 0) {
|
||||
vsyslog(level, fmt, ap);
|
||||
if (level <= LOG_ERR)
|
||||
ERR_print_errors_cb(print_syslog, &level);
|
||||
@ -119,7 +119,7 @@ static void killall(int ret, pid_t *kidpids)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < multi; ++i)
|
||||
for (i = 0; i < n_responders; ++i)
|
||||
if (kidpids[i] != 0)
|
||||
(void)kill(kidpids[i], SIGTERM);
|
||||
OPENSSL_free(kidpids);
|
||||
@ -153,8 +153,8 @@ void spawn_loop(const char *prog)
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
kidpids = app_malloc(multi * sizeof(*kidpids), "child PID array");
|
||||
for (i = 0; i < multi; ++i)
|
||||
kidpids = app_malloc(n_responders * sizeof(*kidpids), "child PID array");
|
||||
for (i = 0; i < n_responders; ++i)
|
||||
kidpids[i] = 0;
|
||||
|
||||
signal(SIGINT, noteterm);
|
||||
@ -167,7 +167,7 @@ void spawn_loop(const char *prog)
|
||||
* Wait for a child to replace when we're at the limit.
|
||||
* Slow down if a child exited abnormally or waitpid() < 0
|
||||
*/
|
||||
while (termsig == 0 && procs >= multi) {
|
||||
while (termsig == 0 && procs >= n_responders) {
|
||||
if ((fpid = waitpid(-1, &status, 0)) > 0) {
|
||||
for (i = 0; i < procs; ++i) {
|
||||
if (kidpids[i] == fpid) {
|
||||
@ -176,7 +176,7 @@ void spawn_loop(const char *prog)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= multi) {
|
||||
if (i >= n_responders) {
|
||||
syslog(LOG_ERR, "fatal: internal error: "
|
||||
"no matching child slot for pid: %ld",
|
||||
(long)fpid);
|
||||
@ -221,14 +221,14 @@ void spawn_loop(const char *prog)
|
||||
}
|
||||
return;
|
||||
default: /* parent */
|
||||
for (i = 0; i < multi; ++i) {
|
||||
for (i = 0; i < n_responders; ++i) {
|
||||
if (kidpids[i] == 0) {
|
||||
kidpids[i] = fpid;
|
||||
procs++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= multi) {
|
||||
if (i >= n_responders) {
|
||||
syslog(LOG_ERR, "fatal: internal error: no free child slots");
|
||||
killall(1, kidpids);
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ int ocsp_main(int argc, char **argv)
|
||||
break;
|
||||
case OPT_MULTI:
|
||||
#ifdef HTTP_DAEMON
|
||||
multi = atoi(opt_arg());
|
||||
n_responders = atoi(opt_arg());
|
||||
#endif
|
||||
break;
|
||||
case OPT_PROV_CASES:
|
||||
@ -633,7 +633,7 @@ int ocsp_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#ifdef HTTP_DAEMON
|
||||
if (multi != 0 && acbio != NULL)
|
||||
if (n_responders != 0 && acbio != NULL)
|
||||
spawn_loop(prog);
|
||||
if (acbio != NULL && req_timeout > 0)
|
||||
signal(SIGALRM, socket_timeout);
|
||||
|
Loading…
Reference in New Issue
Block a user