From: Kern Sibbald Date: Wed, 30 May 2012 17:02:33 +0000 (+0200) Subject: Fix TCP Heartbeat code X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=33fef04eb0291f837e4a9d5a5eb8f6cc7568166a;p=bacula%2Fbacula Fix TCP Heartbeat code --- diff --git a/bacula/src/lib/bsock.c b/bacula/src/lib/bsock.c index 891b10f3e4..4dd3955522 100644 --- a/bacula/src/lib/bsock.c +++ b/bacula/src/lib/bsock.c @@ -35,6 +35,7 @@ #include "bacula.h" #include "jcr.h" #include +#include #ifndef ENODATA /* not defined on BSD systems */ #define ENODATA EPIPE @@ -258,10 +259,10 @@ bool BSOCK::open(JCR *jcr, const char *name, char *host, char *service, } #if defined(TCP_KEEPIDLE) if (heart_beat) { - int opt = heart_beat - if (setsockopt(sockfd, IPPROTO_IP, TCP_KEEPIDLE, (sockopt_val_t)&opt, sizeof(opt)) < 0) { + int opt = heart_beat; + if (setsockopt(sockfd, SOL_TCP, TCP_KEEPIDLE, (sockopt_val_t)&opt, sizeof(opt)) < 0) { berrno be; - Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPIDLE on socket: %s\n"), + Qmsg1(jcr, M_WARNING, 0, _("Cannot set TCP_KEEPIDLE on socket: %s\n"), be.bstrerror()); } } diff --git a/regress/scripts/new-test-bacula-dir.conf.in b/regress/scripts/new-test-bacula-dir.conf.in index 534324cca3..d0febef52c 100644 --- a/regress/scripts/new-test-bacula-dir.conf.in +++ b/regress/scripts/new-test-bacula-dir.conf.in @@ -21,6 +21,7 @@ Director { # define myself SubSysDirectory = "@subsysdir@" PluginDirectory = "@sbindir@" Maximum Concurrent Jobs = 4 + Heartbeat Interval = 330 Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" # Console password Messages = Standard } @@ -468,6 +469,7 @@ Storage { Device = FileStorage Media Type = File Maximum Concurrent Jobs = 10 + Heartbeat Interval = 330 } Storage { @@ -478,6 +480,7 @@ Storage { Device = FileStorage1 Media Type = File1 Maximum Concurrent Jobs = 10 + Heartbeat Interval = 330 }