aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorPerlover <perlover@perlover.com>2021-11-26 17:27:48 +0100
committerPerlover <perlover@perlover.com>2021-12-01 13:05:58 +0100
commit091ccc38c2e589b649648cbcc99aca4802f98775 (patch)
treed1bd0d4609174c5e3d1a3de94b33dce150514222 /src/httpserver.cpp
parente7507f333bc93047d0baadea4fde19f770dacb56 (diff)
downloadbitcoin-091ccc38c2e589b649648cbcc99aca4802f98775.tar.xz
The evhttp_connection_get_peer function from libevent changes the type of the second parameter. Fixing the problem.
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 6e75e28596..59569b20a4 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -2,6 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
#include <httpserver.h>
#include <chainparamsbase.h>
@@ -597,7 +601,13 @@ CService HTTPRequest::GetPeer() const
// evhttp retains ownership over returned address string
const char* address = "";
uint16_t port = 0;
+
+#if HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
+ evhttp_connection_get_peer(con, &address, &port);
+#else
evhttp_connection_get_peer(con, (char**)&address, &port);
+#endif // HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
+
peer = LookupNumeric(address, port);
}
return peer;