]> git.sur5r.net Git - bacula/bacula/commitdiff
Minor bsock cleanup in stored
authorKern Sibbald <kern@sibbald.com>
Sat, 8 Aug 2009 14:11:24 +0000 (16:11 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 8 Aug 2009 14:11:24 +0000 (16:11 +0200)
bacula/src/lib/bnet.c
bacula/src/stored/append.c
bacula/src/stored/spool.c

index ee2415db8d8caae6c4e88e01089731923a095278..8f802b15111eaa286f8b88bc474c96734e8db3b7 100644 (file)
@@ -192,7 +192,7 @@ int32_t bnet_recv(BSOCK * bsock)
  */
 bool is_bnet_stop(BSOCK * bsock)
 {
-   return bsock->errors || bsock->is_terminated();
+   return bsock->is_stop();
 }
 
 /*
@@ -200,8 +200,7 @@ bool is_bnet_stop(BSOCK * bsock)
  */
 int is_bnet_error(BSOCK * bsock)
 {
-   errno = bsock->b_errno;
-   return bsock->errors;
+   return bsock->is_error();
 }
 
 /*
index 9a00694638ca4681fd0c2866708dd49a3c02f088..df97cc9df011ce6abe7499458e8838d2652dc1a3 100644 (file)
@@ -219,25 +219,26 @@ bool do_append_data(JCR *jcr)
          if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX ||
              crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) {
             if (!jcr->no_attributes) {
+               BSOCK *dir = jcr->dir_bsock;
                if (are_attributes_spooled(jcr)) {
-                  jcr->dir_bsock->set_spooling();
+                  dir->set_spooling();
                }
                Dmsg0(850, "Send attributes to dir.\n");
                if (!dir_update_file_attributes(dcr, &rec)) {
-                  jcr->dir_bsock->clear_spooling();
+                  dir->clear_spooling();
                   Jmsg(jcr, M_FATAL, 0, _("Error updating file attributes. ERR=%s\n"),
-                     jcr->dir_bsock->bstrerror());
+                     dir->bstrerror());
                   ok = false;
                   break;
                }
-               jcr->dir_bsock->clear_spooling();
+               dir->clear_spooling();
             }
          }
          Dmsg0(650, "Enter bnet_get\n");
       }
       Dmsg1(650, "End read loop with FD. Stat=%d\n", n);
 
-      if (is_bnet_error(ds)) {
+      if (ds->is_error()) {
          Dmsg1(350, "Network read error from FD. ERR=%s\n", ds->bstrerror());
          Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"),
                ds->bstrerror());
index f13bfdf3e2c1e669efed606e40efda44733d1388..f462538bf7cf837dad512fa4bfa5b91d176cec58 100644 (file)
@@ -642,14 +642,19 @@ static void make_unique_spool_filename(JCR *jcr, POOLMEM **name, int fd)
       jcr->Job, fd);
 }
 
+/*
+ * Tell Director where to find the attributes spool file 
+ *  Note, if we are not on the same machine, the Director will
+ *  return an error, and the higher level routine will transmit
+ *  the data record by record -- using bsock->despool().
+ */
 static bool blast_attr_spool_file(JCR *jcr, boffset_t size)
 {
    /* send full spool file name */
    POOLMEM *name  = get_pool_memory(PM_MESSAGE);
    make_unique_spool_filename(jcr, &name, jcr->dir_bsock->m_fd);
    bash_spaces(name);
-   jcr->dir_bsock->fsend("BlastAttr Job=%s File=%s\n",
-                         jcr->Job, name);
+   jcr->dir_bsock->fsend("BlastAttr Job=%s File=%s\n", jcr->Job, name);
    free_pool_memory(name);
    
    if (jcr->dir_bsock->recv() <= 0) {
@@ -711,7 +716,7 @@ bail_out:
    return false;
 }
 
-bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
+static bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
 {
    POOLMEM *name  = get_pool_memory(PM_MESSAGE);
 
@@ -731,7 +736,7 @@ bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
    return true;
 }
 
-bool close_attr_spool_file(JCR *jcr, BSOCK *bs)
+static bool close_attr_spool_file(JCR *jcr, BSOCK *bs)
 {
    POOLMEM *name;