TCP KEEPALIVE support

Add tcp keeplaive support on platforms that support these socket options.
Set default to fail the socket after 120 seconds
This commit is contained in:
Ronnie Sahlberg
2011-04-13 21:35:51 +10:00
parent 120f41f225
commit b6782dd7c8
3 changed files with 54 additions and 1 deletions

View File

@@ -64,6 +64,16 @@ if test x"$libiscsi_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
fi
AC_CACHE_CHECK([for tcp keepalive],libiscsi_cv_HAVE_TCP_KEEPALIVE,[
AC_TRY_COMPILE([#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>],
[int foo = TCP_KEEPCNT + TCP_KEEPIDLE + TCP_KEEPINTVL],
libiscsi_cv_HAVE_TCP_KEEPALIVE=yes,libiscsi_cv_HAVE_TCP_KEEPALIVE=no)])
if test x"$libiscsi_cv_HAVE_TCP_KEEPALIVE" = x"yes"; then
AC_DEFINE(HAVE_TCP_KEEPALIVE,1,[Whether we have support for tcp keepalive socket options])
fi
AC_MSG_CHECKING(whether libpopt is available)
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"