]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/read.c
Clean up some SD message nos.
[bacula/bacula] / bacula / src / stored / read.c
index 9a363885191774ee2b10e1f7dbff4b50de697244..d59f5418f710e9aa039df1b7b02f5133cf993a4a 100644 (file)
@@ -6,7 +6,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -55,6 +55,7 @@ int do_read_data(JCR *jcr)
    BSOCK *ds;
    BSOCK *fd_sock = jcr->file_bsock;
    int ok = TRUE;
+   int done = FALSE;
    DEVICE *dev;
    DEV_RECORD *rec;
    DEV_BLOCK *block;
@@ -112,15 +113,15 @@ int do_read_data(JCR *jcr)
     *  Read records, apply BSR filtering, and return any that are 
     *   matched.
     */
-   for ( ;ok; ) {
-      if (job_cancelled(jcr)) {
+   for ( ;ok && !done; ) {
+      if (job_canceled(jcr)) {
         ok = FALSE;
         break;
       }
       /* Read Record */
       Dmsg1(500, "Main read_record. rem=%d\n", rec->remainder);
 
-      if (!read_block_from_device(dev, block)) {
+      if (block_is_empty(block) && !read_block_from_device(dev, block)) {
          Dmsg1(500, "Main read record failed. rem=%d\n", rec->remainder);
         if (dev->state & ST_EOT) {
            DEV_RECORD *record;
@@ -171,7 +172,7 @@ int do_read_data(JCR *jcr)
         if (jcr->bsr) {
            int stat = match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec);
            if (stat == -1) {         /* no more possible matches */
-              ok = FALSE;
+              done = TRUE;
               break;
            } else if (stat == 0) {   /* no match */
                Dmsg0(50, "BSR rejected record\n");
@@ -197,6 +198,9 @@ int do_read_data(JCR *jcr)
          * out the data record
          */
         ds->msg = hdr;
+         Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n",
+           rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream,
+           rec->data_len);
         if (!bnet_fsend(ds, rec_header, rec->VolSessionId, rec->VolSessionTime,
                rec->FileIndex, rec->Stream, rec->data_len)) {
             Dmsg1(30, ">filed: Error Hdr=%s\n", ds->msg);