Skip to content

Commit 4be0b08

Browse files
theunilaanwj
authored andcommitted
libevent: Windows reuseaddr workaround in depends
Make it possible to reuse sockets. This is necessary to make the RPC tests work in WINE.
1 parent 3a174cd commit 4be0b08

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

depends/packages/libevent.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ $(package)_version=2.0.22
33
$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-2.0.22-stable
44
$(package)_file_name=$(package)-$($(package)_version)-stable.tar.gz
55
$(package)_sha256_hash=71c2c49f0adadacfdbe6332a372c38cf9c8b7895bb73dabeaa53cdcc1d4e1fa3
6+
$(package)_patches=reuseaddr.patch
7+
8+
define $(package)_preprocess_cmds
9+
patch -p1 < $($(package)_patch_dir)/reuseaddr.patch
10+
endef
611

712
define $(package)_set_vars
813
$(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--- old/evutil.c 2015-08-28 19:26:23.488765923 -0400
2+
+++ new/evutil.c 2015-08-28 19:27:41.392767019 -0400
3+
@@ -321,15 +321,16 @@
4+
int
5+
evutil_make_listen_socket_reuseable(evutil_socket_t sock)
6+
{
7+
-#ifndef WIN32
8+
int one = 1;
9+
+#ifndef WIN32
10+
/* REUSEADDR on Unix means, "don't hang on to this address after the
11+
* listener is closed." On Windows, though, it means "don't keep other
12+
* processes from binding to this address while we're using it. */
13+
return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &one,
14+
(ev_socklen_t)sizeof(one));
15+
#else
16+
- return 0;
17+
+ return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*) &one,
18+
+ (ev_socklen_t)sizeof(one));
19+
#endif
20+
}
21+

0 commit comments

Comments
 (0)