mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94
This commit is contained in:
parent
7bc822cad9
commit
d9118c8daa
@ -715,8 +715,7 @@ AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct s
|
|||||||
#endif
|
#endif
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_CHECK_TYPES([struct so_linger],
|
AC_CHECK_TYPES([struct linger],,,
|
||||||
[#define HAVE_SO_LINGER], ,
|
|
||||||
[
|
[
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -113,13 +113,13 @@ errorcb(struct bufferevent *b, short what, void *arg)
|
|||||||
static void
|
static void
|
||||||
frob_socket(evutil_socket_t sock)
|
frob_socket(evutil_socket_t sock)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SO_LINGER
|
#ifdef EVENT__HAVE_STRUCT_LINGER
|
||||||
struct linger l;
|
struct linger l;
|
||||||
#endif
|
#endif
|
||||||
int one = 1;
|
int one = 1;
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one))<0)
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one))<0)
|
||||||
perror("setsockopt(SO_REUSEADDR)");
|
perror("setsockopt(SO_REUSEADDR)");
|
||||||
#ifdef HAVE_SO_LINGER
|
#ifdef EVENT__HAVE_STRUCT_LINGER
|
||||||
l.l_onoff = 1;
|
l.l_onoff = 1;
|
||||||
l.l_linger = 0;
|
l.l_linger = 0;
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&l, sizeof(l))<0)
|
if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&l, sizeof(l))<0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user