Beispiel #1
0
/*
 * Free the Job Control Record if no one is still using it.
 *  Called from main free_jcr() routine in src/lib/jcr.c so
 *  that we can do our Director specific cleanup of the jcr.
 */
void dird_free_jcr(JCR *jcr)
{
   Dmsg0(200, "Start dird free_jcr\n");

   dird_free_jcr_pointers(jcr);
   if (jcr->term_wait_inited) {
      pthread_cond_destroy(&jcr->term_wait);
      jcr->term_wait_inited = false;
   }

   if (jcr->nextrun_ready_inited) {
      pthread_cond_destroy(&jcr->nextrun_ready);
      jcr->nextrun_ready_inited = false;
   }

   if (jcr->db_batch) {
      db_sql_close_pooled_connection(jcr, jcr->db_batch);
      jcr->db_batch = NULL;
      jcr->batch_started = false;
   }

   if (jcr->db) {
      db_sql_close_pooled_connection(jcr, jcr->db);
      jcr->db = NULL;
   }

   if (jcr->restore_tree_root) {
      free_tree(jcr->restore_tree_root);
   }

   if (jcr->bsr) {
      free_bsr(jcr->bsr);
      jcr->bsr = NULL;
   }

   free_and_null_pool_memory(jcr->stime);
   free_and_null_pool_memory(jcr->fname);
   free_and_null_pool_memory(jcr->res.pool_source);
   free_and_null_pool_memory(jcr->res.npool_source);
   free_and_null_pool_memory(jcr->res.rpool_source);
   free_and_null_pool_memory(jcr->res.wstore_source);
   free_and_null_pool_memory(jcr->res.rstore_source);
   free_and_null_pool_memory(jcr->res.catalog_source);

   /*
    * Delete lists setup to hold storage pointers
    */
   free_rwstorage(jcr);

   jcr->job_end_push.destroy();

   if (jcr->JobId != 0) {
      write_state_file(director->working_directory, "bareos-dir", get_first_port_host_order(director->DIRaddrs));
   }

   free_plugins(jcr);                 /* release instantiated plugins */

   Dmsg0(200, "End dird free_jcr\n");
}
Beispiel #2
0
/*
 * Free the Job Control Record if no one is still using it.
 *  Called from main free_jcr() routine in src/lib/jcr.c so
 *  that we can do our Director specific cleanup of the jcr.
 */
void dird_free_jcr(JCR *jcr)
{
   Dmsg0(200, "Start dird free_jcr\n");

   dird_free_jcr_pointers(jcr);
   if (jcr->term_wait_inited) {
      pthread_cond_destroy(&jcr->term_wait);
      jcr->term_wait_inited = false;
   }
   if (jcr->db_batch) {
      db_close_database(jcr, jcr->db_batch);
      jcr->db_batch = NULL;
      jcr->batch_started = false;
   }
   if (jcr->db) {
      db_close_database(jcr, jcr->db);
      jcr->db = NULL;
   }

   free_and_null_pool_memory(jcr->stime);
   free_and_null_pool_memory(jcr->fname);
   free_and_null_pool_memory(jcr->pool_source);
   free_and_null_pool_memory(jcr->catalog_source);
   free_and_null_pool_memory(jcr->rpool_source);
   free_and_null_pool_memory(jcr->wstore_source);
   free_and_null_pool_memory(jcr->rstore_source);

   /* Delete lists setup to hold storage pointers */
   free_rwstorage(jcr);

   jcr->job_end_push.destroy();

   if (jcr->JobId != 0)
      write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));

   free_plugins(jcr);                 /* release instantiated plugins */

   Dmsg0(200, "End dird free_jcr\n");
}