From b4b363cccfb7612141c3b815b9d2fbfd9dbe26d6 Mon Sep 17 00:00:00 2001 From: erqan Date: Sun, 2 Aug 2015 14:37:01 +0300 Subject: [PATCH] option to disable rss at compilation --- Makefile.am | 8 ++++++-- configure.ac | 25 +++++++++++++++++++++++++ src/bitcoinrpc.cpp | 5 +++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 86f56fba..61908900 100644 --- a/Makefile.am +++ b/Makefile.am @@ -131,6 +131,10 @@ if USE_SSE2 SSE2_SOURCES = src/scrypt-sse2.cpp endif +if ENABLE_RSS +RSS_SOURCE = src/twister_rss.cpp +endif + BITCOIN_TWISTER_SOURCES = \ src/alert.cpp \ src/version.cpp \ @@ -169,9 +173,9 @@ BITCOIN_TWISTER_SOURCES = \ src/chainparams.cpp \ src/dhtproxy.cpp \ src/twister.cpp \ - src/twister_rss.cpp \ src/twister_utils.cpp \ - $(SSE2_SOURCES) + $(SSE2_SOURCES) \ + $(RSS_SOURCES) twisterd_SOURCES = $(LIBTORRENT_SOURCES) $(BITCOIN_TWISTER_SOURCES) diff --git a/configure.ac b/configure.ac index 83cd12b5..5aca804d 100644 --- a/configure.ac +++ b/configure.ac @@ -393,6 +393,15 @@ AC_ARG_ENABLE( [[ARG_ENABLE_PYTHON_BINDING=no]] ) +AC_ARG_ENABLE( + [rss], + [AS_HELP_STRING( + [--enable-rss], + [enable rss feed [default=yes]])], + [[ARG_ENABLE_RSS=$enableval]], + [[ARG_ENABLE_RSS=yes]] +) + AC_ARG_WITH( [libgeoip], [AS_HELP_STRING( @@ -608,6 +617,20 @@ AS_CASE(["$ARG_ENABLE_POOL_ALLOC"], AC_MSG_ERROR([Unknown option "$ARG_ENABLE_POOL_ALLOC". Use either "yes" or "no".])] ) +AC_MSG_CHECKING([whether rss feed should be enabled]) +AS_CASE(["$ARG_ENABLE_RSS"], + ["yes"|"on"], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([ENABLE_RSS],[1],[Enable RSS]) + CXXFLAGS="$CXXFLAGS -DENABLE_RSS " + ], + ["no"|"off"], [ + AC_MSG_RESULT([no]) + ], + [AC_MSG_RESULT([$ARG_ENABLE_RSS]) + AC_MSG_ERROR([Unknown option "$ARG_ENABLE_RSS". Use either "yes" or "no".])] +) + AS_ECHO AS_ECHO "Checking for extra build files:" @@ -725,6 +748,7 @@ AM_CONDITIONAL([ENABLE_PYTHON_BINDING], [test "x$ARG_ENABLE_PYTHON_BINDING" = "x AM_CONDITIONAL([WITH_SHIPPED_GEOIP], [test "x$ARG_WITH_LIBGEOIP" = "xno" ]) AM_CONDITIONAL([WITH_OPENSSL], [test "x$ARG_ENABLE_ENCRYPTION" = "xyes" -o "x$ARG_ENABLE_ENCRYPTION" = "xon" ]) AM_CONDITIONAL([USE_SSE2], [test "x$ARG_ENABLE_SSE2" = "xyes" -o "x$ARG_ENABLE_SSE2" = "xon" ]) +AM_CONDITIONAL([ENABLE_RSS], [test "x$ARG_ENABLE_RSS" = "xyes" -o "x$ARG_ENABLE_RSS" = "xon" ]) ############################################################################### # Other useful stuff @@ -827,6 +851,7 @@ Features: geoip support: ${ARG_ENABLE_GEOIP:-yes} dht support: ${ARG_ENABLE_DHT:-yes} pool allocators: ${ARG_ENABLE_POOL_ALLOC:-yes} + rss feed: ${ARG_ENABLE_RSS:-yes} Extra builds: examples: ${ARG_ENABLE_EXAMPLES:-no} diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 978b40b7..042217ed 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -13,7 +13,10 @@ #include "db.h" #include "twister_utils.h" + +#ifdef ENABLE_RSS #include "twister_rss.h" +#endif // ENABLE_RSS #include #include @@ -1057,6 +1060,7 @@ void ServiceConnection(AcceptedConnection *conn) continue; } +#ifdef ENABLE_RSS if(strMethod == "GET" && strURI.substr(0, 4) == "/rss" && !GetBoolArg("-public_server_mode",false)) { string rssOutput; @@ -1081,6 +1085,7 @@ void ServiceConnection(AcceptedConnection *conn) continue; } } +#endif // ENABLE_RSS JSONRequest jreq; try