From f8418dbd0c3694a4c9487f95429d7d48c153904d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 24 Aug 2007 16:20:49 +0000 Subject: [PATCH] kes Fix bad SD->FD return status reported by (James Harper) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5401 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/fd_cmds.c | 52 ++++++++++++++++++------------------- bacula/src/version.h | 4 +-- bacula/technotes-2.3 | 2 ++ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 8bbddbcd31..1c16b0f24c 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -120,7 +120,7 @@ void run_job(JCR *jcr) dir->set_jcr(jcr); Dmsg1(120, "Start run Job=%s\n", jcr->Job); - bnet_fsend(dir, Job_start, jcr->Job); + dir->fsend(Job_start, jcr->Job); jcr->start_time = time(NULL); jcr->run_time = jcr->start_time; set_jcr_job_status(jcr, JS_Running); @@ -130,9 +130,9 @@ void run_job(JCR *jcr) dequeue_messages(jcr); /* send any queued messages */ set_jcr_job_status(jcr, JS_Terminated); generate_daemon_event(jcr, "JobEnd"); - bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, + dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, edit_uint64(jcr->JobBytes, ec1)); - bnet_sig(dir, BNET_EOD); /* send EOD to Director daemon */ + dir->signal(BNET_EOD); /* send EOD to Director daemon */ return; } @@ -150,7 +150,7 @@ void do_fd_commands(JCR *jcr) int stat; /* Read command coming from the File daemon */ - stat = bnet_recv(fd); + stat = fd->recv(); if (is_bnet_stop(fd)) { /* hardeof or error */ break; /* connection terminated */ } @@ -171,11 +171,11 @@ void do_fd_commands(JCR *jcr) } if (!found) { /* command not found */ Dmsg1(110, "msg); - bnet_fsend(fd, ferrmsg); + fd->fsend(ferrmsg); break; } } - bnet_sig(fd, BNET_TERMINATE); /* signal to FD job is done */ + fd->signal(BNET_TERMINATE); /* signal to FD job is done */ } /* @@ -195,10 +195,10 @@ static bool append_data_cmd(JCR *jcr) return true; } else { bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */ - bnet_fsend(fd, ERROR_append); + fd->fsend(ERROR_append); } } else { - bnet_fsend(fd, NOT_opened); + fd->fsend(NOT_opened); } return false; } @@ -209,11 +209,11 @@ static bool append_end_session(JCR *jcr) Dmsg1(120, "storemsg); if (!jcr->session_opened) { - bnet_fsend(fd, NOT_opened); + fd->fsend(NOT_opened); return false; } set_jcr_job_status(jcr, JS_Terminated); - return bnet_fsend(fd, OK_end); + return fd->fsend(OK_end); } @@ -227,14 +227,14 @@ static bool append_open_session(JCR *jcr) Dmsg1(120, "Append open session: %s", fd->msg); if (jcr->session_opened) { - bnet_fsend(fd, NO_open); + fd->fsend(NO_open); return false; } jcr->session_opened = true; /* Send "Ticket" to File Daemon */ - bnet_fsend(fd, OK_open, jcr->VolSessionId); + fd->fsend(OK_open, jcr->VolSessionId); Dmsg1(110, ">filed: %s", fd->msg); return true; @@ -251,14 +251,14 @@ static bool append_close_session(JCR *jcr) Dmsg1(120, "msg); if (!jcr->session_opened) { - bnet_fsend(fd, NOT_opened); + fd->fsend(NOT_opened); return false; } /* Send final statistics to File daemon */ - bnet_fsend(fd, OK_close, jcr->JobStatus); + fd->fsend(OK_close, jcr->JobStatus); Dmsg1(120, ">filed: %s", fd->msg); - bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */ + fd->signal(BNET_EOD); /* send EOD to File daemon */ jcr->session_opened = false; return true; @@ -279,7 +279,7 @@ static bool read_data_cmd(JCR *jcr) Dmsg1(120, "msg); return do_read_data(jcr); } else { - bnet_fsend(fd, NOT_opened); + fd->fsend(NOT_opened); return false; } } @@ -296,7 +296,7 @@ static bool read_open_session(JCR *jcr) Dmsg1(120, "%s\n", fd->msg); if (jcr->session_opened) { - bnet_fsend(fd, NO_open); + fd->fsend(NO_open); return false; } @@ -304,7 +304,7 @@ static bool read_open_session(JCR *jcr) &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile, &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) { if (jcr->session_opened) { - bnet_fsend(fd, NOT_opened); + fd->fsend(NOT_opened); return false; } Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n", @@ -319,7 +319,7 @@ static bool read_open_session(JCR *jcr) jcr->JobType = JT_RESTORE; /* Send "Ticket" to File Daemon */ - bnet_fsend(fd, OK_open, jcr->VolSessionId); + fd->fsend(OK_open, jcr->VolSessionId); Dmsg1(110, ">filed: %s", fd->msg); return true; @@ -357,7 +357,7 @@ bool get_bootstrap_file(JCR *jcr, BSOCK *sock) goto bail_out; } Dmsg0(10, "=== Bootstrap file ===\n"); - while (bnet_recv(sock) >= 0) { + while (sock->recv() >= 0) { Dmsg1(10, "%s", sock->msg); fputs(sock->msg, bs); } @@ -378,10 +378,10 @@ bail_out: free_pool_memory(jcr->RestoreBootstrap); jcr->RestoreBootstrap = NULL; if (!ok) { - bnet_fsend(sock, ERROR_bootstrap); + sock->fsend(ERROR_bootstrap); return false; } - return bnet_fsend(sock, OK_bootstrap); + return sock->fsend(OK_bootstrap); } @@ -395,14 +395,14 @@ static bool read_close_session(JCR *jcr) Dmsg1(120, "Read close session: %s\n", fd->msg); if (!jcr->session_opened) { - bnet_fsend(fd, NOT_opened); + fd->fsend(NOT_opened); return false; } - /* Send final statistics to File daemon */ - bnet_fsend(fd, OK_close, jcr->JobStatus); + /* Send final close msg to File daemon */ + fd->fsend(OK_close, jcr->JobStatus); Dmsg1(160, ">filed: %s\n", fd->msg); - bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */ + fd->signal(BNET_EOD); /* send EOD to File daemon */ jcr->session_opened = false; return true; diff --git a/bacula/src/version.h b/bacula/src/version.h index 6ddcfdbbc1..ce7eaa588a 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.1" -#define BDATE "23 August 2007" -#define LSMDATE "23Aug07" +#define BDATE "24 August 2007" +#define LSMDATE "24Aug07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 7c6f3a12cc..71fcfa9bd5 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -2,6 +2,8 @@ General: 24Aug07 +kes Fix bad SD->FD return status reported by + (James Harper) ebl Fix a bug in read_close_session which return random status thanks to James Harper 23Aug07 -- 2.39.5