]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/heartbeat.c
Complete port to Windows
[bacula/bacula] / bacula / src / filed / heartbeat.c
index cb80c769eaf5fc3a260faf58da360a0922863cee..7a77621610d61c67b9b5b065f3aaff355b4e029f 100644 (file)
@@ -13,7 +13,7 @@
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
-   version 2 as ammended with additional clauses defined in the
+   version 2 as amended with additional clauses defined in the
    file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
@@ -26,7 +26,7 @@
 #include "bacula.h"
 #include "filed.h"
 
-#define WAIT_INTERVAL 10
+#define WAIT_INTERVAL 5
 
 extern "C" void *sd_heartbeat_thread(void *arg);
 extern "C" void *dir_heartbeat_thread(void *arg);
@@ -49,12 +49,6 @@ extern "C" void *sd_heartbeat_thread(void *arg)
 
    /* Get our own local copy */
    sd = dup_bsock(jcr->store_bsock);
-#ifndef WIN32
-   int oflags;
-   if ((oflags = fcntl(sd->fd, F_GETFL, 0)) != -1) {
-      fcntl(sd->fd, F_SETFL, oflags|O_NONBLOCK);
-   }
-#endif
    dir = dup_bsock(jcr->dir_bsock);
 
    jcr->hb_bsock = sd;
@@ -74,7 +68,7 @@ extern "C" void *sd_heartbeat_thread(void *arg)
             last_heartbeat = now;
          }
       }
-      if (is_bnet_stop(sd)) {
+      if (n < 0 || is_bnet_stop(sd)) {
          break;
       }
       if (n == 1) {                   /* input waiting */
@@ -85,7 +79,7 @@ extern "C" void *sd_heartbeat_thread(void *arg)
             Dmsg2(100, "Got %d bytes from SD. MSG=%s\n", sd->msglen, sd->msg);
          }
       }
-      Dmsg2(000, "wait_intr=%d stop=%d\n", n, is_bnet_stop(sd));
+      Dmsg2(100, "wait_intr=%d stop=%d\n", n, is_bnet_stop(sd));
    }
    bnet_close(sd);
    bnet_close(dir);
@@ -139,8 +133,6 @@ void stop_heartbeat_monitor(JCR *jcr)
       pthread_kill(jcr->heartbeat_id, TIMEOUT_SIGNAL);  /* make heartbeat thread go away */
       bmicrosleep(0, 500000);
    }
-   if (jcr->hb_bsock) {
-   }
 }
 
 /*