*/
void catalog_update(JCR *jcr, BSOCK *bs)
{
- POOLMEM *omsg;
-
- if (job_canceled(jcr) || !jcr->pool->catalog_files) {
- goto bail_out; /* user disabled cataloging */
+ if (!jcr->pool->catalog_files) {
+ return; /* user disabled cataloging */
+ }
+ if (job_canceled(jcr)) {
+ goto bail_out;
}
if (!jcr->db) {
- omsg = get_memory(bs->msglen+1);
+ POOLMEM *omsg = get_memory(bs->msglen+1);
pm_strcpy(omsg, bs->msg);
bs->fsend(_("1994 Invalid Catalog Update: %s"), omsg);
Jmsg1(jcr, M_FATAL, 0, _("Invalid Catalog Update; DB not open: %s"), omsg);
free_memory(omsg);
goto bail_out;
-
}
-
update_attribute(jcr, bs->msg, bs->msglen);
bail_out:
last = size;
}
}
- update_attribute(jcr, msg, msglen);
+ if (!job_canceled(jcr)) {
+ update_attribute(jcr, msg, msglen);
+ if (job_canceled(jcr)) {
+ goto bail_out;
+ }
+ }
}
if (ferror(spool_fd)) {
berrno be;
void cancel_storage_daemon_job(JCR *jcr)
{
+ if (jcr->sd_canceled) {
+ return; /* cancel only once */
+ }
+
UAContext *ua = new_ua_context(jcr);
JCR *control_jcr = new_control_jcr("*JobCancel*", JT_SYSTEM);
BSOCK *sd;
sd->signal(BNET_TERMINATE);
sd->close();
ua->jcr->store_bsock = NULL;
+ jcr->sd_canceled = true;
}
bail_out:
free_jcr(control_jcr);
bool run_full_pool_override;
bool run_inc_pool_override;
bool run_diff_pool_override;
+ bool sd_canceled; /* set if SD canceled */
FILESET *fileset; /* FileSet resource */
CAT *catalog; /* Catalog resource */
MSGS *messages; /* Default message handler */
size_t nbytes;
ssize_t last = 0, size = 0;
int count = 0;
+ JCR *jcr = get_jcr();
rewind(m_spool_fd);
}
}
send();
+ if (jcr && job_canceled(jcr)) {
+ return false;
+ }
+ send();
}
update_attr_spool_size(tsize - last);
if (ferror(m_spool_fd)) {
berrno be;
- Qmsg1(get_jcr(), M_FATAL, 0, _("fread attr spool error. ERR=%s\n"),
+ Qmsg1(jcr, M_FATAL, 0, _("fread attr spool error. ERR=%s\n"),
be.bstrerror());
return false;
}