test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94

This commit is contained in:
Jan Beich 2017-01-28 16:17:07 +00:00 committed by Azat Khuzhin
parent 7bc822cad9
commit d9118c8daa
2 changed files with 3 additions and 4 deletions

View File

@ -715,8 +715,7 @@ AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct s
#endif
])
AC_CHECK_TYPES([struct so_linger],
[#define HAVE_SO_LINGER], ,
AC_CHECK_TYPES([struct linger],,,
[
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>

View File

@ -113,13 +113,13 @@ errorcb(struct bufferevent *b, short what, void *arg)
static void
frob_socket(evutil_socket_t sock)
{
#ifdef HAVE_SO_LINGER
#ifdef EVENT__HAVE_STRUCT_LINGER
struct linger l;
#endif
int one = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one))<0)
perror("setsockopt(SO_REUSEADDR)");
#ifdef HAVE_SO_LINGER
#ifdef EVENT__HAVE_STRUCT_LINGER
l.l_onoff = 1;
l.l_linger = 0;
if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&l, sizeof(l))<0)