From d66b1d4fe6b19fdf29ead13b922f65601bd478a9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 30 May 2012 19:02:33 +0200 Subject: [PATCH] Fix TCP Heartbeat code --- bacula/src/lib/bsock.c | 7 ++++--- regress/scripts/new-test-bacula-dir.conf.in | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) 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 } -- 2.39.5