1 Index: src/dird/backup.c
2 ===================================================================
3 --- src/dird/backup.c (révision 7736)
4 +++ src/dird/backup.c (copie de travail)
6 /* Come here only after starting SD thread */
8 set_jcr_job_status(jcr, JS_ErrorTerminated);
9 - Dmsg1(400, "wait for sd. use=%d\n", jcr->use_count());
11 - wait_for_job_termination(jcr, FDConnectTimeout);
12 - Dmsg1(400, "after wait for sd. use=%d\n", jcr->use_count());
13 + Dmsg1(400, "wait for sd and fd. use=%d\n", jcr->use_count());
14 + /* Get status from SD and FD */
15 + wait_for_job_termination(jcr); /* TODO: don't expect the EndJob message */
16 + Dmsg1(400, "after wait for sd and fd. use=%d\n", jcr->use_count());
21 * are done, we return the job status.
22 * Also used by restore.c
24 -int wait_for_job_termination(JCR *jcr, int timeout)
25 +int wait_for_job_termination(JCR *jcr)
28 BSOCK *fd = jcr->file_bsock;
30 uint64_t JobBytes = 0;
35 set_jcr_job_status(jcr, JS_Running);
39 - tid = start_bsock_timer(fd, timeout); /* TODO: New timeout directive??? */
41 - /* Wait for Client to terminate */
42 - while ((n = bget_dirmsg(fd)) >= 0) {
44 - (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
45 - &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 ||
46 - sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles,
47 - &ReadBytes, &JobBytes, &Errors) == 5)) {
49 - set_jcr_job_status(jcr, jcr->FDJobStatus);
50 - Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus);
52 - Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"),
54 + /* Wait for Client to terminate
55 + * In some conditions, the client isn't able to send
56 + * any messages and we should not wait for ages
61 + ret = fd->wait_data_intr(5*60, 0); /* wait for data few minutes */
63 + if (ret == 1) { /* get data */
64 + n = bget_dirmsg(fd);
65 + if (n >= 0 && !fd_ok &&
66 + (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
67 + &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 ||
68 + sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles,
69 + &ReadBytes, &JobBytes, &Errors) == 5)) {
70 + OK=false; /* end of loop */
72 + set_jcr_job_status(jcr, jcr->FDJobStatus);
74 + Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"),
77 + } /* else get timeout or network error */
79 + if (is_bnet_error(fd)) {
80 + Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"),
81 + job_type_to_str(jcr->get_JobType()), fd->bstrerror());
83 if (job_canceled(jcr)) {
89 - stop_bsock_timer(tid);
92 - if (is_bnet_error(fd)) {
93 - Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"),
94 - job_type_to_str(jcr->get_JobType()), fd->bstrerror());
96 fd->signal(BNET_TERMINATE); /* tell Client we are terminating */
99 Index: src/dird/protos.h
100 ===================================================================
101 --- src/dird/protos.h (révision 7736)
102 +++ src/dird/protos.h (copie de travail)
104 extern bool find_recycled_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr);
107 -extern int wait_for_job_termination(JCR *jcr, int timeout=0);
108 +extern int wait_for_job_termination(JCR *jcr);
109 extern bool do_backup_init(JCR *jcr);
110 extern bool do_backup(JCR *jcr);
111 extern void backup_cleanup(JCR *jcr, int TermCode);