+ update_job_end(jcr, TermCode);
+
+ if (jcr->unlink_bsr && jcr->RestoreBootstrap) {
+ unlink(jcr->RestoreBootstrap);
+ jcr->unlink_bsr = false;
+ }
+
+ if (job_canceled(jcr)) {
+ cancel_storage_daemon_job(jcr);
+ }
+
+ switch (TermCode) {
+ case JS_Terminated:
+ if (jcr->ExpectedFiles > jcr->jr.JobFiles) {
+ term_msg = _("Restore OK -- warning file count mismatch");
+ } else {
+ term_msg = _("Restore OK");
+ }
+ break;
+ case JS_FatalError:
+ case JS_ErrorTerminated:
+ term_msg = _("*** Restore Error ***");
+ msg_type = M_ERROR; /* Generate error message */
+ if (jcr->store_bsock) {
+ jcr->store_bsock->signal(BNET_TERMINATE);
+ if (jcr->SD_msg_chan) {
+ pthread_cancel(jcr->SD_msg_chan);
+ }
+ }
+ break;
+ case JS_Canceled:
+ term_msg = _("Restore Canceled");
+ if (jcr->store_bsock) {
+ jcr->store_bsock->signal(BNET_TERMINATE);
+ if (jcr->SD_msg_chan) {
+ pthread_cancel(jcr->SD_msg_chan);
+ }
+ }
+ break;
+ default:
+ term_msg = term_code;
+ sprintf(term_code, _("Inappropriate term code: %c\n"), TermCode);
+ break;
+ }
+ bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
+ bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
+ if (jcr->jr.EndTime - jcr->jr.StartTime > 0) {
+ kbps = (double)jcr->jr.JobBytes / (1000 * (jcr->jr.EndTime - jcr->jr.StartTime));
+ } else {
+ kbps = 0;