@@ -29,8 +29,7 @@ namespace node {
2929 subscribe<CLASS>(&CLASS::method, __VA_ARGS__)
3030
3131using namespace system ;
32- using namespace network ::rpc;
33- using namespace network ::http;
32+ using namespace network ;
3433using namespace network ::json;
3534using namespace std ::placeholders;
3635
@@ -130,7 +129,7 @@ void protocol_bitcoind_rpc::handle_receive_post(const code& ec,
130129 }
131130
132131 // Endpoint accepts only json-rpc posts.
133- if (!post ->body ().contains <in_value >())
132+ if (!post ->body ().contains <rpc::request >())
134133 {
135134 send_bad_request (*post );
136135 return ;
@@ -139,14 +138,14 @@ void protocol_bitcoind_rpc::handle_receive_post(const code& ec,
139138 // Get the parsed json-rpc request object.
140139 // v1 or v2 both supported, batch not yet supported.
141140 // v1 null id and v2 missing id implies notification and no response.
142- const auto & request = post ->body ().get <in_value >().message ;
141+ const auto & message = post ->body ().get <rpc::request >().message ;
143142
144143 // The post is saved off during asynchonous handling and used in send_json
145144 // to formulate response headers, isolating handlers from http semantics.
146- set_rpc_request (request .jsonrpc , request .id , post );
145+ set_rpc_request (message .jsonrpc , message .id , post );
147146
148147 // Dispatch the request to subscribers.
149- if (const auto code = rpc_dispatcher_.notify (request ))
148+ if (const auto code = rpc_dispatcher_.notify (message ))
150149 stop (code);
151150}
152151
@@ -361,15 +360,15 @@ void protocol_bitcoind_rpc::send_error(const code& ec,
361360 send_error (ec, {}, size_hint);
362361}
363362
364- void protocol_bitcoind_rpc::send_error (const code& ec, value_option&& error,
365- size_t size_hint) NOEXCEPT
363+ void protocol_bitcoind_rpc::send_error (const code& ec,
364+ rpc::value_option&& error, size_t size_hint) NOEXCEPT
366365{
367366 BC_ASSERT (stranded ());
368367 send_rpc (
369368 {
370369 .jsonrpc = version_,
371370 .id = id_,
372- .error = result_t
371+ .error = rpc:: result_t
373372 {
374373 .code = ec.value (),
375374 .message = ec.message (),
@@ -384,7 +383,7 @@ void protocol_bitcoind_rpc::send_text(std::string&& hexidecimal) NOEXCEPT
384383 send_result (hexidecimal, hexidecimal.size ());
385384}
386385
387- void protocol_bitcoind_rpc::send_result (value_option&& result,
386+ void protocol_bitcoind_rpc::send_result (rpc:: value_option&& result,
388387 size_t size_hint) NOEXCEPT
389388{
390389 BC_ASSERT (stranded ());
@@ -397,27 +396,28 @@ void protocol_bitcoind_rpc::send_result(value_option&& result,
397396}
398397
399398// private
400- void protocol_bitcoind_rpc::send_rpc (response_t && model,
399+ void protocol_bitcoind_rpc::send_rpc (rpc:: response_t && model,
401400 size_t size_hint) NOEXCEPT
402401{
403402 BC_ASSERT (stranded ());
403+ using namespace http ;
404404 static const auto json = from_media_type (media_type::application_json);
405405 const auto request = reset_rpc_request ();
406- response response { status::ok, request->version () };
407- add_common_headers (response , *request);
408- add_access_control_headers (response , *request);
409- response .set (field::content_type, json);
410- response .body () = out_value
406+ http:: response message { status::ok, request->version () };
407+ add_common_headers (message , *request);
408+ add_access_control_headers (message , *request);
409+ message .set (field::content_type, json);
410+ message .body () = rpc::response
411411 {
412412 { .size_hint = size_hint }, std::move (model),
413413 };
414- response .prepare_payload ();
415- SEND (std::move (response ), handle_complete, _1, error::success);
414+ message .prepare_payload ();
415+ SEND (std::move (message ), handle_complete, _1, error::success);
416416}
417417
418418// private
419- void protocol_bitcoind_rpc::set_rpc_request (version version,
420- const id_option& id, const request_cptr& request) NOEXCEPT
419+ void protocol_bitcoind_rpc::set_rpc_request (rpc:: version version,
420+ const rpc:: id_option& id, const http:: request_cptr& request) NOEXCEPT
421421{
422422 BC_ASSERT (stranded ());
423423 id_ = id;
@@ -426,11 +426,11 @@ void protocol_bitcoind_rpc::set_rpc_request(version version,
426426}
427427
428428// private
429- request_cptr protocol_bitcoind_rpc::reset_rpc_request () NOEXCEPT
429+ http:: request_cptr protocol_bitcoind_rpc::reset_rpc_request () NOEXCEPT
430430{
431431 BC_ASSERT (stranded ());
432432 id_.reset ();
433- version_ = version::undefined;
433+ version_ = rpc:: version::undefined;
434434 return reset_request ();
435435}
436436
0 commit comments