]> git.tue.mpg.de Git - paraslash.git/commitdiff
server: Loglevel adjustments for shutdown path.
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 21 Oct 2021 19:48:24 +0000 (21:48 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 12 Mar 2022 01:06:23 +0000 (02:06 +0100)
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.

acl.c
send_common.c
udp_send.c
vss.c

diff --git a/acl.c b/acl.c
index 2c90052658eda947ea586a55f292dc85f24e68f7..59ffab3e0a188a8ac921555b83a9276907ecfa46 100644 (file)
--- 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);
index 9debdfca5a40a7ada404e9cf4a034140e2509a6b..90242d5c9b5ccb125617004e16fbf9b64d5484f6 100644 (file)
  */
 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);
index 91550aa8c66836239df07193d46d5d470612767e..68d75e3c3ef87dc089a3a1eec4d59fb647e73e44 100644 (file)
@@ -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 9e2e32ca3b3bd7979b3c564ff1959dcbe7560446..a4dfa94ed5a20f136ed83b8c4d003afd3f187886 100644 (file)
--- 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();
        }
 }