]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/dird.c
Apply Eric's next-beta.patch that enables 64 bit FileIds and
[bacula/bacula] / bacula / src / dird / dird.c
index 2f2092df402779f226bd43051d1820bbf2419850..edf4a650be912507c93a99294722cfba2b63fa5b 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -300,6 +300,7 @@ int main (int argc, char *argv[])
    init_python_interpreter(&python_args);
 #endif /* HAVE_PYTHON */
 
+   set_jcr_in_tsd(INVALID_JCR);
    set_thread_concurrency(director->MaxConcurrentJobs * 2 +
       4 /* UA */ + 4 /* sched+watchdog+jobsvr+misc */);
 
@@ -312,7 +313,7 @@ int main (int argc, char *argv[])
 
    init_job_server(director->MaxConcurrentJobs);
 
-   dbg_add_hook(_db_print_dbg); /* used to debug B_DB connexion after fatal signal */
+   dbg_jcr_add_hook(_dbg_print_db); /* used to debug B_DB connexion after fatal signal */
 
 //   init_device_resources();
 
@@ -321,6 +322,7 @@ int main (int argc, char *argv[])
    while ( (jcr = wait_for_next_job(runjob)) ) {
       run_job(jcr);                   /* run job */
       free_jcr(jcr);                  /* release jcr */
+      set_jcr_in_tsd(INVALID_JCR);
       if (runjob) {                   /* command line, run a single job? */
          break;                       /* yes, terminate */
       }
@@ -383,6 +385,7 @@ void terminate_dird(int sig)
    term_msg();                        /* terminate message handler */
    cleanup_crypto();
    close_memory_pool();               /* release free memory in pool */
+   lmgr_cleanup_main();
    sm_dump(false);
    exit(sig);
 }
@@ -942,7 +945,19 @@ static bool check_catalog()
           */
          if (!pool->catalog || pool->catalog == catalog) {
             create_pool(NULL, db, pool, POOL_OP_UPDATE);  /* update request */
-            update_pool_recyclepool(NULL, db, pool);
+         }
+      }
+
+      /* Once they are created, we can loop over them again, updating
+       * references (RecyclePool)
+       */
+      foreach_res(pool, R_POOL) {
+         /*
+          * If the Pool has a catalog resource update the pool only
+          *   in that catalog.
+          */
+         if (!pool->catalog || pool->catalog == catalog) {
+            update_pool_references(NULL, db, pool);
          }
       }