]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dircmd.c
Print length if Hello to short or long
[bacula/bacula] / bacula / src / stored / dircmd.c
index 4e49725dae35650ea118a182c9b4a5935fca05a6..de421646e7ab89946644eb7f8b08e55cb01cca11 100644 (file)
@@ -106,7 +106,7 @@ static struct s_cmds cmds[] = {
  *  - We execute the command
  *  - We continue or exit depending on the return status
  */
-void connection_request(void *arg)
+void *connection_request(void *arg)
 {
    BSOCK *bs = (BSOCK *)arg;
    JCR *jcr;
@@ -116,7 +116,7 @@ void connection_request(void *arg)
 
    if (bnet_recv(bs) <= 0) {
       Emsg0(M_ERROR, 0, "Connection request failed.\n");
-      return;
+      return NULL;
    }
 
    /* 
@@ -124,7 +124,7 @@ void connection_request(void *arg)
     */
    if (sscanf(bs->msg, "Hello Start Job %127s calling\n", name) == 1) {
       handle_filed_connection(bs, name);
-      return;
+      return NULL;
    }
    
    jcr = new_jcr(sizeof(JCR), stored_free_jcr);     /* create Job Control Record */
@@ -138,7 +138,7 @@ void connection_request(void *arg)
    if (!authenticate_director(jcr)) {
       Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate Director\n"));
       free_jcr(jcr);
-      return;
+      return NULL;
    }
    Dmsg0(90, "Message channel init completed.\n");
 
@@ -170,7 +170,7 @@ void connection_request(void *arg)
       bnet_sig(bs, BNET_TERMINATE);
    }
    free_jcr(jcr);
-   return;
+   return NULL;
 }
 
 /*
@@ -216,6 +216,13 @@ static int cancel_cmd(JCR *cjcr)
         if (jcr->file_bsock) {
            bnet_sig(jcr->file_bsock, BNET_TERMINATE);
         }
+        /* If thread waiting on mount, wake him */
+        if (jcr->device && jcr->device->dev &&      
+             (jcr->device->dev->dev_blocked == BST_WAITING_FOR_SYSOP ||
+              jcr->device->dev->dev_blocked == BST_UNMOUNTED ||
+              jcr->device->dev->dev_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP)) {
+            pthread_cond_signal(&jcr->device->dev->wait_next_vol);
+        }
          bnet_fsend(dir, _("3000 Job %s marked to be cancelled.\n"), jcr->Job);
         free_jcr(jcr);
       }
@@ -468,7 +475,8 @@ static int mount_cmd(JCR *jcr)
                   bnet_fsend(dir, _("3001 Device %s is mounted with Volume %s\n"), 
                     dev->dev_name, dev->VolHdr.VolName);
               } else {
-                  bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n"), 
+                  bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n"
+                                    "Try unmounting and remounting the Volume.\n"),
                             dev->dev_name);
               }
               break;
@@ -488,7 +496,8 @@ static int mount_cmd(JCR *jcr)
                      bnet_fsend(dir, _("3001 Device %s is mounted with Volume %s\n"),
                        dev->dev_name, dev->VolHdr.VolName);
                  } else {
-                     bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n"), 
+                     bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n"   
+                                    "Try unmounting and remounting the Volume.\n"),
                                dev->dev_name);
                  }
               } else {
@@ -506,7 +515,8 @@ static int mount_cmd(JCR *jcr)
                      bnet_fsend(dir, _("3001 Device %s is mounted with Volume %s\n"), 
                        dev->dev_name, dev->VolHdr.VolName);
                  } else {
-                     bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n"), 
+                     bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n"
+                                       "Try unmounting and remounting the Volume.\n"),
                                dev->dev_name);
                  }
               }
@@ -626,7 +636,7 @@ static int status_cmd(JCR *jcr)
    char dt[MAX_TIME_LENGTH];
    char b1[30], b2[30], b3[30];
 
-   bnet_fsend(user, "\n%s Version: " VERSION " (" DATE ")\n", my_name);
+   bnet_fsend(user, "\n%s Version: " VERSION " (" BDATE ")\n", my_name);
    bstrftime(dt, sizeof(dt), daemon_start_time);
    bnet_fsend(user, _("Daemon started %s, %d Job%s run.\n"), dt, last_job.NumJobs,
         last_job.NumJobs == 1 ? "" : "s");