From: Andre Noll Date: Thu, 21 Oct 2021 19:48:24 +0000 (+0200) Subject: server: Loglevel adjustments for shutdown path. X-Git-Tag: v0.7.0~4 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=3ed650b6ce773a8ed341c4edf9b81888e76b546c;p=paraslash.git server: Loglevel adjustments for shutdown path. The log output of the server is rather verbose with respect to shutdown messages. These not only occur when the server exits but also in command handler context each time a command is executed. This patch quietens these messages in two ways. For some messages we simply reduce the log level. For others we print the message only in server context, i.e. when process_is_command_handler() returns false. --- diff --git a/acl.c b/acl.c index 2c900526..59ffab3e 100644 --- a/acl.c +++ b/acl.c @@ -101,7 +101,7 @@ static void acl_del_entry(struct list_head *acl, char *addr, unsigned netmask) struct access_info *ai, *tmp; struct in_addr to_delete; - PARA_NOTICE_LOG("removing entries matching %s/%u\n", addr, netmask); + PARA_INFO_LOG("removing entries matching %s/%u\n", addr, netmask); inet_pton(AF_INET, addr, &to_delete); list_for_each_entry_safe(ai, tmp, acl, node) { @@ -111,7 +111,7 @@ static void acl_del_entry(struct list_head *acl, char *addr, unsigned netmask) const char *p = inet_ntop(AF_INET, &ai->addr.s_addr, dst, sizeof(dst)); if (p) - PARA_INFO_LOG("removing %s/%u\n", p, + PARA_DEBUG_LOG("removing %s/%u\n", p, ai->netmask); list_del(&ai->node); free(ai); diff --git a/send_common.c b/send_common.c index 9debdfca..90242d5c 100644 --- a/send_common.c +++ b/send_common.c @@ -44,12 +44,12 @@ */ void shutdown_client(struct sender_client *sc, struct sender_status *ss) { - PARA_INFO_LOG("shutting down %s on fd %d\n", sc->name, sc->fd); - free(sc->name); if (!process_is_command_handler()) { + PARA_INFO_LOG("shutting down %s on fd %d\n", sc->name, sc->fd); close(sc->fd); del_close_on_fork_list(sc->fd); } + free(sc->name); cq_destroy(sc->cq); list_del(&sc->node); free(sc->private_data); diff --git a/udp_send.c b/udp_send.c index 91550aa8..68d75e3c 100644 --- a/udp_send.c +++ b/udp_send.c @@ -60,7 +60,7 @@ static void udp_close_target(struct sender_client *sc) return; if (ut->sent_fec_eof) return; - PARA_NOTICE_LOG("sending FEC EOF\n"); + PARA_INFO_LOG("sending FEC EOF\n"); len = vss_get_fec_eof_packet(&buf); /* Ignore write() errors since we are closing the target anyway. */ if (write(sc->fd, buf, len)) @@ -72,7 +72,8 @@ static void udp_delete_target(struct sender_client *sc, const char *msg) { struct udp_target *ut = sc->private_data; - PARA_NOTICE_LOG("deleting %s (%s) from list\n", sc->name, msg); + if (!process_is_command_handler()) + PARA_NOTICE_LOG("deleting %s (%s) from list\n", sc->name, msg); udp_close_target(sc); /* command handlers already called close_listed_fds() */ if (!process_is_command_handler()) { @@ -248,7 +249,7 @@ static int udp_init_fec(struct sender_client *sc) struct udp_target *ut = sc->private_data; int mps; - PARA_NOTICE_LOG("sending to udp %s\n", sc->name); + PARA_INFO_LOG("sending to udp %s\n", sc->name); ut->sent_fec_eof = false; mps = generic_max_transport_msg_size(sc->fd) - sizeof(struct udphdr); PARA_INFO_LOG("current MPS = %d bytes\n", mps); diff --git a/vss.c b/vss.c index 9e2e32ca..a4dfa94e 100644 --- a/vss.c +++ b/vss.c @@ -1140,7 +1140,7 @@ static int vss_post_select(struct sched *s, void *context) if (vsst->afsss != AFS_SOCKET_CHECK_FOR_WRITE) recv_afs_result(vsst, &s->rfds); else if (FD_ISSET(vsst->afs_socket, &s->wfds)) { - PARA_NOTICE_LOG("requesting new fd from afs\n"); + PARA_INFO_LOG("requesting new fd from afs\n"); ret = write_buffer(vsst->afs_socket, "new"); if (ret < 0) PARA_CRIT_LOG("%s\n", para_strerror(-ret)); @@ -1209,11 +1209,14 @@ void vss_init(int afs_socket, struct sched *s) void vss_shutdown(void) { int i; + bool is_command_handler = process_is_command_handler(); FOR_EACH_SENDER(i) { if (!senders[i]->shutdown) continue; - PARA_NOTICE_LOG("shutting down %s sender\n", senders[i]->name); + if (!is_command_handler) + PARA_NOTICE_LOG("shutting down %s sender\n", + senders[i]->name); senders[i]->shutdown(); } }