From 1d6ab32ea572054f8340b202ae511675cba64d8d Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Mon, 4 May 2009 09:56:51 +0200 Subject: [PATCH] Fix #333455 - Workaround IPTOS_LOWDELAY not supported --- NEWS | 2 ++ configure.ac | 4 ++++ src/Makefile.am | 1 + src/modbus.c | 3 +++ 4 files changed, 10 insertions(+), 0 deletions(-) diff --git a/NEWS b/NEWS index b55b9ae..9fed62e 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ libmodbus 2.2.0 (2009-05-01) - modbus_param_t is smaller (2 int removed) - Better error management - Faster +- Fix #333455 reported by Jeff Laughlin + Cygwin IPTOS_LOWDELAY not supported on cygwin libmodbus 2.0.3 (2009-03-22) ============================ diff --git a/configure.ac b/configure.ac index f4b63e2..288deb3 100644 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,7 @@ AC_PREREQ(2.59) AC_INIT(libmodbus, 2.0.3, stephane.raimbault@gmail.com) AC_CONFIG_SRCDIR([src/modbus.c]) +AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE AM_DISABLE_STATIC @@ -25,6 +26,9 @@ AC_HEADER_TIME AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T +AC_CHECK_DECLS([IPTOS_LOWDELAY], + [have_iptos_lowdelay=yes], [have_iptos_lowdelay=no], + [#include ]) # Checks for library functions. AC_FUNC_FORK diff --git a/src/Makefile.am b/src/Makefile.am index 7469c0a..60fa7aa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ lib_LTLIBRARIES = libmodbus.la libmodbus_la_SOURCES = modbus.c modbus.h libmodbus_la_LDFLAGS = -version-info 2:0:0 +service_CFLAGS = -I$(top_srcdir)/ # Include files to install libmodbusincludedir = $(includedir)/modbus diff --git a/src/modbus.c b/src/modbus.c index 2e21f01..7b6911c 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -28,6 +28,7 @@ http://copyleft.free.fr/wordpress/index.php/libmodbus/ */ +#include #include #include #include @@ -1685,6 +1686,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param) return ret; } +#ifdef HAVE_DECL_IPTOS_LOWDELAY /* Set the IP low delay option */ option = IPTOS_LOWDELAY; ret = setsockopt(mb_param->fd, IPPROTO_TCP, IP_TOS, @@ -1694,6 +1696,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param) close(mb_param->fd); return ret; } +#endif if (mb_param->debug) { printf("Connecting to %s\n", mb_param->ip); -- libgit2 0.21.4