@@ -184,7 +184,6 @@ struct HTTPReply
184184static std::string http_errorstring (int code)
185185{
186186 switch (code) {
187- #if LIBEVENT_VERSION_NUMBER >= 0x02010300
188187 case EVREQ_HTTP_TIMEOUT:
189188 return " timeout reached" ;
190189 case EVREQ_HTTP_EOF:
@@ -197,7 +196,6 @@ static std::string http_errorstring(int code)
197196 return " request was canceled" ;
198197 case EVREQ_HTTP_DATA_TOO_LONG:
199198 return " response body is larger than allowed" ;
200- #endif
201199 default :
202200 return " unknown" ;
203201 }
@@ -228,13 +226,11 @@ static void http_request_done(struct evhttp_request *req, void *ctx)
228226 }
229227}
230228
231- #if LIBEVENT_VERSION_NUMBER >= 0x02010300
232229static void http_error_cb (enum evhttp_request_error err, void *ctx)
233230{
234231 HTTPReply *reply = static_cast <HTTPReply*>(ctx);
235232 reply->error = err;
236233}
237- #endif
238234
239235/* * Class that handles the conversion from a command-line to a JSON-RPC request,
240236 * as well as converting back to a JSON object that can be shown as result.
@@ -745,11 +741,11 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
745741
746742 HTTPReply response;
747743 raii_evhttp_request req = obtain_evhttp_request (http_request_done, (void *)&response);
748- if (req == nullptr )
744+ if (req == nullptr ) {
749745 throw std::runtime_error (" create http request failed" );
750- #if LIBEVENT_VERSION_NUMBER >= 0x02010300
746+ }
747+
751748 evhttp_request_set_error_cb (req.get (), http_error_cb);
752- #endif
753749
754750 // Get credentials
755751 std::string strRPCUserColonPass;
0 commit comments