Removed the caching of netconfig entries. The caching of configdb entries now serves...
[citadel.git] / citadel / modules / network / serv_network.c
index c6ca869da4b9946342b3dd6fbc14028a4a18e80a..a597a68bb93e6ebe6e1aa59ed8ac8a8331ad801e 100644 (file)
@@ -2,15 +2,15 @@
  * This module handles shared rooms, inter-Citadel mail, and outbound
  * mailing list processing.
  *
- * Copyright (c) 2000-2012 by the citadel.org team
+ * Copyright (c) 2000-2015 by the citadel.org team
  *
- *  This program is open source software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License, version 3.
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 3.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
  * ** NOTE **   A word on the S_NETCONFIGS semaphore:
  * This is a fairly high-level type of critical section.  It ensures that no
@@ -87,7 +87,9 @@ extern uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
 
 typedef struct __roomlists {
        RoomProcList *rplist;
-}roomlists;
+} roomlists;
+
+
 /*
  * When we do network processing, it's accomplished in two passes; one to
  * gather a list of rooms and one to actually do them.  It's ok that rplist
@@ -113,8 +115,7 @@ int network_sync_to(char *target_node, long len)
        /* Grab the configuration line we're looking for */
        begin_critical_section(S_NETCONFIGS);
        pRNCFG = CtdlGetNetCfgForRoom(CCC->room.QRnumber);
-       if ((pRNCFG == NULL) ||
-           (pRNCFG->NetConfigs[ignet_push_share] == NULL))
+       if ((pRNCFG == NULL) || (pRNCFG->NetConfigs[ignet_push_share] == NULL))
        {
                return -1;
        }
@@ -137,17 +138,11 @@ int network_sync_to(char *target_node, long len)
        sc.RNCfg->NetConfigs[ignet_push_share] = DuplicateOneGenericCfgLine(pCfgLine);
        sc.Users[ignet_push_share] = NewStrBufPlain(NULL,
                                                    StrLength(pCfgLine->Value[0]) +
-                                                   StrLength(pCfgLine->Value[1]) + 10);
-       StrBufAppendBuf(sc.Users[ignet_push_share], 
-                       pCfgLine->Value[0],
-                       0);
-       StrBufAppendBufPlain(sc.Users[ignet_push_share], 
-                            HKEY(","),
-                            0);
-
-       StrBufAppendBuf(sc.Users[ignet_push_share], 
-                       pCfgLine->Value[1],
-                       0);
+                                                   StrLength(pCfgLine->Value[1]) + 10
+       );
+       StrBufAppendBuf(sc.Users[ignet_push_share], pCfgLine->Value[0], 0);
+       StrBufAppendBufPlain(sc.Users[ignet_push_share], HKEY(","), 0);
+       StrBufAppendBuf(sc.Users[ignet_push_share], pCfgLine->Value[1], 0);
        CalcListID(&sc);
 
        end_critical_section(S_NETCONFIGS);
@@ -156,8 +151,7 @@ int network_sync_to(char *target_node, long len)
        sc.the_netmap = CtdlReadNetworkMap();
 
        /* Send ALL messages */
-       num_spooled = CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL,
-               network_spool_msg, &sc);
+       num_spooled = CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, network_spool_msg, &sc);
 
        /* Concise cleanup because we know there's only one node in the sc */
        DeleteGenericCfgLine(NULL/*TODO*/, &sc.RNCfg->NetConfigs[ignet_push_share]);
@@ -313,10 +307,11 @@ void network_do_queue(void)
         * Run the full set of processing tasks no more frequently
         * than once every n seconds
         */
-       if ( (time(NULL) - last_run) < config.c_net_freq ) {
+       if ( (time(NULL) - last_run) < CtdlGetConfigLong("c_net_freq") )
+       {
                full_processing = 0;
                syslog(LOG_DEBUG, "Network full processing in %ld seconds.\n",
-                      config.c_net_freq - (time(NULL)- last_run)
+                      CtdlGetConfigLong("c_net_freq") - (time(NULL)- last_run)
                );
        }
 
@@ -426,7 +421,7 @@ void network_do_queue(void)
                last_run = time(NULL);
        }
        destroy_network_queue_room(RL.rplist);
-       SaveChangedConfigs();
+       // SaveChangedConfigs();        // FIXME FOOFOO SAVE CHANGED THIS AACACACACCKK
 
 }