aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-08-31 11:17:26 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-09-03 10:59:19 +0200
commit4be0b082b97062be4df20e9c45dafa577b05b07c (patch)
tree6f331d8dc827ef0f7a27ffb89348800bb7bd4936
parent3a174cd400c6c239539d4c0c10b557c3e0615212 (diff)
libevent: Windows reuseaddr workaround in depends
Make it possible to reuse sockets. This is necessary to make the RPC tests work in WINE.
-rw-r--r--depends/packages/libevent.mk5
-rw-r--r--depends/patches/libevent/reuseaddr.patch21
2 files changed, 26 insertions, 0 deletions
diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk
index 3388a28437..2e9be1e98c 100644
--- a/depends/packages/libevent.mk
+++ b/depends/packages/libevent.mk
@@ -3,6 +3,11 @@ $(package)_version=2.0.22
$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-2.0.22-stable
$(package)_file_name=$(package)-$($(package)_version)-stable.tar.gz
$(package)_sha256_hash=71c2c49f0adadacfdbe6332a372c38cf9c8b7895bb73dabeaa53cdcc1d4e1fa3
+$(package)_patches=reuseaddr.patch
+
+define $(package)_preprocess_cmds
+ patch -p1 < $($(package)_patch_dir)/reuseaddr.patch
+endef
define $(package)_set_vars
$(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress
diff --git a/depends/patches/libevent/reuseaddr.patch b/depends/patches/libevent/reuseaddr.patch
new file mode 100644
index 0000000000..58695c11f5
--- /dev/null
+++ b/depends/patches/libevent/reuseaddr.patch
@@ -0,0 +1,21 @@
+--- old/evutil.c 2015-08-28 19:26:23.488765923 -0400
++++ new/evutil.c 2015-08-28 19:27:41.392767019 -0400
+@@ -321,15 +321,16 @@
+ int
+ evutil_make_listen_socket_reuseable(evutil_socket_t sock)
+ {
+-#ifndef WIN32
+ int one = 1;
++#ifndef WIN32
+ /* REUSEADDR on Unix means, "don't hang on to this address after the
+ * listener is closed." On Windows, though, it means "don't keep other
+ * processes from binding to this address while we're using it. */
+ return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &one,
+ (ev_socklen_t)sizeof(one));
+ #else
+- return 0;
++ return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*) &one,
++ (ev_socklen_t)sizeof(one));
+ #endif
+ }
+