Hi, I've noticed that bacula has in code some support for changing
time for SO_KEEPALIVE on sockets, but it was not being activated
(even on systems supporting TCP_KEEPIDLE in setsockopt(2))
Attached is a simple patch which fixes that in place where TCP_KEEPIDLE
was supposed to being used (it could be probably added to
./src/lib/bnet_server.c too, but I'm not that deep in bacula code yet)
It was made against GIT Branch-5.0 as of 2010-04-20
--- src/lib/bsock.c.org 2010-04-20 17:08:22.000000000 +0200
+++ src/lib/bsock.c 2010-04-21 12:45:01.000000000 +0200
@@ -37,6 +37,10 @@
#include "bacula.h"
#include "jcr.h"
#include <netdb.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
#ifndef ENODATA /* not defined on BSD systems */
#define ENODATA EPIPE
@@ -251,8 +255,8 @@
}
#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, IPPROTO_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"),
be.bstrerror());
------------------------------------------------------------------------------
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel