Fix locking of netcnofigs
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 28 Oct 2014 07:29:17 +0000 (08:29 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 28 Oct 2014 07:29:17 +0000 (08:29 +0100)
citadel/modules/network/serv_netspool.c

index 96ac8bf6ced32492f229f914ba0ea7dc098db553..714bb0471918db577cc597c25e9b5d7e05313f45 100644 (file)
@@ -209,11 +209,13 @@ void InspectQueuedRoom(SpoolControl **pSC,
                return;
        }
 
+       begin_critical_section(S_NETCONFIGS);
        if (sc->RNCfg == NULL)
                sc->RNCfg = CtdlGetNetCfgForRoom(sc->room.QRnumber);
 
        if (!HaveSpoolConfig(sc->RNCfg))
        {
+               end_critical_section(S_NETCONFIGS);
                free(sc);
                /* nothing to do for this room... */
                return;
@@ -231,6 +233,7 @@ void InspectQueuedRoom(SpoolControl **pSC,
        
        if (StrLength(sc->RNCfg->Sender) > 0)
                sc->Users[roommailalias] = NewStrBufDup(sc->RNCfg->Sender);
+       end_critical_section(S_NETCONFIGS);
 
        sc->next = *pSC;
        *pSC = sc;
@@ -400,12 +403,13 @@ void network_spoolout_room(SpoolControl *sc)
        /* Now rewrite the config file */
        if (sc->lastsent != lastsent)
        {
+               begin_critical_section(S_NETCONFIGS);
                sc->RNCfg = CtdlGetNetCfgForRoom(sc->room.QRnumber);
 
                sc->RNCfg->lastsent = sc->lastsent;
                sc->RNCfg->changed = 1;
+               end_critical_section(S_NETCONFIGS);
        }
-       end_critical_section(S_NETCONFIGS);
 }
 
 /*