]> code.citadel.org Git - citadel.git/commitdiff
* Automatically purge files from ./network/spoolout which were intended
authorArt Cancro <ajc@citadel.org>
Sat, 7 Feb 2004 05:28:10 +0000 (05:28 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 7 Feb 2004 05:28:10 +0000 (05:28 +0000)
  for nodes which no longer exist

citadel/ChangeLog
citadel/serv_network.c

index f41b5202a00f58c0836263d544706cef9cf0e7e1..540d7b20ea2f64fd8b7cc8b9799846060dd50932 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 614.22  2004/02/07 05:28:10  ajc
+ * Automatically purge files from ./network/spoolout which were intended
+   for nodes which no longer exist
+
  Revision 614.21  2004/02/07 04:59:21  ajc
  * Cache the IGnet config in memory, avoiding a db fetch for every single
    operation which references it.  Invalidate the cache when a new config
@@ -5293,3 +5297,4 @@ 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 5b60cdabbd5d6473ec303c642a345625ec19801f..878be3451a46fd7735c06b98ecb2e2a9979e57a5 100644 (file)
@@ -1281,6 +1281,35 @@ void network_do_spoolin(void) {
 }
 
 
+/*
+ * Delete any files in the outbound queue that were intended
+ * to be sent to nodes which no nlonger exist.
+ */
+void network_purge_spoolout(void) {
+       DIR *dp;
+       struct dirent *d;
+       char filename[SIZ];
+       char nexthop[SIZ];
+       int i;
+
+       dp = opendir("./network/spoolout");
+       if (dp == NULL) return;
+
+       while (d = readdir(dp), d != NULL) {
+               snprintf(filename, sizeof filename,
+                       "./network/spoolout/%s", d->d_name);
+
+               strcpy(nexthop, "");
+               i = is_valid_node(nexthop, NULL, d->d_name);
+       
+               if ( (i != 0) || (strlen(nexthop) > 0) ) {
+                       unlink(filename);
+               }
+       }
+
+
+       closedir(dp);
+}
 
 
 
@@ -1587,6 +1616,8 @@ void network_do_queue(void) {
        free_filter_list(filterlist);
        filterlist = NULL;
 
+       network_purge_spoolout();
+
        lprintf(7, "network: queue run completed\n");
 
        if (full_processing) {