* Change the logging level of some messages and add a couple of new ones to
authorMichael Hampton <io_error@uncensored.citadel.org>
Sat, 28 Aug 2004 14:21:25 +0000 (14:21 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sat, 28 Aug 2004 14:21:25 +0000 (14:21 +0000)
  show when a network node is connecting.

citadel/ChangeLog
citadel/citserver.c
citadel/serv_network.c
citadel/sysdep.c

index 520a771ae06d6b266c46d335bb120d81f606d362..3de013abc6e0063ab94299132a569784ecdea97d 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 625.4  2004/08/28 14:21:25  error
+ * Change the logging level of some messages and add a couple of new ones to
+   show when a network node is connecting.
+
  Revision 625.3  2004/08/28 02:42:44  ajc
  * setup.c: when run from the Easy Install script, auto-configure slapd
    and put it into /etc/inittab
@@ -6011,4 +6015,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 9afecf8cf0c9a5953073af706ae6e7a94cc03120..1e52d43e209fcb3a428dc268f52c2571a6d355dd 100644 (file)
@@ -236,7 +236,7 @@ void RemoveContext (struct CitContext *con)
        logout(con);
 
        unlink(con->temp);
-       lprintf(CTDL_NOTICE, "Session %d: ended.\n", con->cs_pid);
+       lprintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
 
        /* Deallocate any user-data attached to this session */
        deallocate_user_data(con);
index 9abbc35a20f3fb7fb9170d8b0e251e364552741b..1df2620bdddd9ede7620451e089dbbb86ebbb649 100644 (file)
@@ -903,7 +903,7 @@ int network_sync_to(char *target_node) {
        /* Concise cleanup because we know there's only one node in the sc */
        free(sc.ignet_push_shares);
 
-       lprintf(CTDL_INFO, "Synchronized %d messages to <%s>\n",
+       lprintf(CTDL_NOTICE, "Synchronized %d messages to <%s>\n",
                num_spooled, target_node);
        return(num_spooled);
 }
@@ -1428,7 +1428,10 @@ void receive_spool(int sock, char *remote_nodename) {
                unlink(tempfilename);
                return;
        }
-       lprintf(CTDL_DEBUG, "%s\n", buf);
+       if (download_len > 0)
+               lprintf(CTDL_NOTICE, "Received %ld octets from <%s>",
+                               download_len, remote_nodename);
+       lprintf(CTDL_DEBUG, "%s", buf);
        snprintf(buf, sizeof buf, "mv %s ./network/spoolin/%s.%ld",
                tempfilename, remote_nodename, (long) getpid());
        system(buf);
@@ -1444,7 +1447,7 @@ void transmit_spool(int sock, char *remote_nodename)
        char buf[SIZ];
        char pbuf[4096];
        long plen;
-       long bytes_to_write, thisblock;
+       long bytes_to_write, thisblock, bytes_written;
        int fd;
        char sfname[128];
 
@@ -1458,14 +1461,13 @@ void transmit_spool(int sock, char *remote_nodename)
        snprintf(sfname, sizeof sfname, "./network/spoolout/%s", remote_nodename);
        fd = open(sfname, O_RDONLY);
        if (fd < 0) {
-               if (errno == ENOENT) {
-                       lprintf(CTDL_INFO, "Nothing to send.\n");
-               } else {
+               if (errno != ENOENT) {
                        lprintf(CTDL_CRIT, "cannot open upload file locally: %s\n",
                                strerror(errno));
                }
                return;
        }
+       bytes_written = 0;
        while (plen = (long) read(fd, pbuf, IGNET_PACKET_SIZE), plen > 0L) {
                bytes_to_write = plen;
                while (bytes_to_write > 0L) {
@@ -1485,7 +1487,8 @@ void transmit_spool(int sock, char *remote_nodename)
                                        close(fd);
                                        return;
                                }
-                               bytes_to_write = bytes_to_write - thisblock;
+                               bytes_to_write -= thisblock;
+                               bytes_written += thisblock;
                        } else {
                                goto ABORTUPL;
                        }
@@ -1496,6 +1499,8 @@ ABORTUPL:
        close(fd);
        if (sock_puts(sock, "UCLS 1") < 0) return;
        if (sock_gets(sock, buf) < 0) return;
+       lprintf(CTDL_NOTICE, "Sent %ld octets to <%s>",
+                       bytes_written, remote_nodename);
        lprintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] == '2') {
                unlink(sfname);
@@ -1513,7 +1518,7 @@ void network_poll_node(char *node, char *secret, char *host, char *port) {
 
        if (network_talking_to(node, NTT_CHECK)) return;
        network_talking_to(node, NTT_ADD);
-       lprintf(CTDL_INFO, "Polling node <%s> at %s:%s\n", node, host, port);
+       lprintf(CTDL_NOTICE, "Connecting to <%s> at %s:%s\n", node, host, port);
 
        sock = sock_connect(host, port, "tcp");
        if (sock < 0) {
@@ -1645,10 +1650,10 @@ void network_do_queue(void) {
         * Go ahead and run the queue
         */
        if (full_processing) {
-               lprintf(CTDL_INFO, "network: loading outbound queue\n");
+               lprintf(CTDL_DEBUG, "network: loading outbound queue\n");
                ForEachRoom(network_queue_room, NULL);
 
-               lprintf(CTDL_INFO, "network: running outbound queue\n");
+               lprintf(CTDL_DEBUG, "network: running outbound queue\n");
                while (rplist != NULL) {
                        network_spoolout_room(rplist->name);
                        ptr = rplist;
@@ -1657,7 +1662,7 @@ void network_do_queue(void) {
                }
        }
 
-       lprintf(CTDL_INFO, "network: processing inbound queue\n");
+       lprintf(CTDL_DEBUG, "network: processing inbound queue\n");
        network_do_spoolin();
 
        /* Save the network map back to disk */
@@ -1669,7 +1674,7 @@ void network_do_queue(void) {
 
        network_purge_spoolout();
 
-       lprintf(CTDL_INFO, "network: queue run completed\n");
+       lprintf(CTDL_DEBUG, "network: queue run completed\n");
 
        if (full_processing) {
                last_run = time(NULL);
@@ -1692,43 +1697,43 @@ void cmd_netp(char *cmdbuf)
        char secret[SIZ];
        char nexthop[SIZ];
 
+       /* Authenticate */
+       extract(node, cmdbuf, 0);
+       extract(pass, cmdbuf, 1);
+
        if (doing_queue) {
-               lprintf(CTDL_DEBUG, "spooling - try again in a few minutes");
+               lprintf(CTDL_WARNING, "Network node <%s> refused - spooling", node);
                cprintf("%d spooling - try again in a few minutes\n",
                        ERROR + RESOURCE_BUSY);
                return;
        }
 
-       /* Authenticate */
-       extract(node, cmdbuf, 0);
-       extract(pass, cmdbuf, 1);
-
        /* load the IGnet Configuration to check node validity */
        load_working_ignetcfg();
        v = is_valid_node(nexthop, secret, node);
 
        if (v != 0) {
-               lprintf(CTDL_DEBUG, "authentication failed (node)");
+               lprintf(CTDL_WARNING, "Unknown node <%s>", node);
                cprintf("%d authentication failed\n",
                        ERROR + PASSWORD_REQUIRED);
                return;
        }
 
        if (strcasecmp(pass, secret)) {
-               lprintf(CTDL_DEBUG, "authentication failed (password)");
+               lprintf(CTDL_WARNING, "Bad password for network node <%s>", node);
                cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
                return;
        }
 
        if (network_talking_to(node, NTT_CHECK)) {
-               lprintf(CTDL_DEBUG, "already talking to you");
+               lprintf(CTDL_WARNING, "Duplicate session for network node <%s>", node);
                cprintf("%d Already talking to %s right now\n", ERROR + RESOURCE_BUSY, node);
                return;
        }
 
        safestrncpy(CC->net_node, node, sizeof CC->net_node);
        network_talking_to(node, NTT_ADD);
-       lprintf(CTDL_DEBUG, "authenticated ok");
+       lprintf(CTDL_NOTICE, "Network node <%s> logged in", CC->net_node);
        cprintf("%d authenticated as network node '%s'\n", CIT_OK,
                CC->net_node);
 }
index 9c97ef21df290107394eef25b319dd3c2d80684d..8fb61866af905b81d3ebd1ee93774a3334bb5e11 100644 (file)
@@ -977,7 +977,7 @@ do_select:  force_purge = 0;
                                                strerror(errno));
                                }
                                else {
-                                       lprintf(CTDL_NOTICE,
+                                       lprintf(CTDL_DEBUG,
                                                "New client socket %d\n",
                                                ssock);