Fix #1772 by decprecating cli_wallet -H
This commit is contained in:
parent
1c0de74aa7
commit
a31e56f531
1 changed files with 19 additions and 23 deletions
|
|
@ -29,10 +29,8 @@
|
|||
|
||||
#include <fc/io/json.hpp>
|
||||
#include <fc/io/stdio.hpp>
|
||||
#include <fc/network/http/server.hpp>
|
||||
#include <fc/network/http/websocket.hpp>
|
||||
#include <fc/rpc/cli.hpp>
|
||||
#include <fc/rpc/http_api.hpp>
|
||||
#include <fc/rpc/websocket_api.hpp>
|
||||
|
||||
#include <graphene/app/api.hpp>
|
||||
|
|
@ -80,7 +78,8 @@ int main( int argc, char** argv )
|
|||
("rpc-endpoint,r", bpo::value<string>()->implicit_value("127.0.0.1:8091"), "Endpoint for wallet websocket RPC to listen on")
|
||||
("rpc-tls-endpoint,t", bpo::value<string>()->implicit_value("127.0.0.1:8092"), "Endpoint for wallet websocket TLS RPC to listen on")
|
||||
("rpc-tls-certificate,c", bpo::value<string>()->implicit_value("server.pem"), "PEM certificate for wallet websocket TLS RPC")
|
||||
("rpc-http-endpoint,H", bpo::value<string>()->implicit_value("127.0.0.1:8093"), "Endpoint for wallet HTTP RPC to listen on")
|
||||
("rpc-http-endpoint,H", bpo::value<string>()->implicit_value("127.0.0.1:8093"),
|
||||
"Endpoint for wallet HTTP RPC to listen on (DEPRECATED, use rpc-endpoint instead)")
|
||||
("daemon,d", "Run the wallet in daemon mode" )
|
||||
("wallet-file,w", bpo::value<string>()->implicit_value("wallet.json"), "wallet to load")
|
||||
("chain-id", bpo::value<string>(), "chain ID to connect to");
|
||||
|
|
@ -175,7 +174,7 @@ int main( int argc, char** argv )
|
|||
fc::http::websocket_client client;
|
||||
idump((wdata.ws_server));
|
||||
auto con = client.connect( wdata.ws_server );
|
||||
auto apic = std::make_shared<fc::rpc::websocket_api_connection>(*con, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
auto apic = std::make_shared<fc::rpc::websocket_api_connection>(con, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
|
||||
auto remote_api = apic->get_remote_api< login_api >(1);
|
||||
edump((wdata.ws_user)(wdata.ws_password) );
|
||||
|
|
@ -214,11 +213,11 @@ int main( int argc, char** argv )
|
|||
_websocket_server->on_connection([&wapi]( const fc::http::websocket_connection_ptr& c ){
|
||||
std::cout << "here... \n";
|
||||
wlog("." );
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(*c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
wsc->register_api(wapi);
|
||||
c->set_session_data( wsc );
|
||||
});
|
||||
ilog( "Listening for incoming RPC requests on ${p}", ("p", options.at("rpc-endpoint").as<string>() ));
|
||||
ilog( "Listening for incoming HTTP and WS RPC requests on ${p}", ("p", options.at("rpc-endpoint").as<string>() ));
|
||||
_websocket_server->listen( fc::ip::endpoint::from_string(options.at("rpc-endpoint").as<string>()) );
|
||||
_websocket_server->start_accept();
|
||||
}
|
||||
|
|
@ -227,35 +226,32 @@ int main( int argc, char** argv )
|
|||
if( options.count( "rpc-tls-certificate" ) )
|
||||
cert_pem = options.at("rpc-tls-certificate").as<string>();
|
||||
|
||||
auto _websocket_tls_server = std::make_shared<fc::http::websocket_tls_server>(cert_pem);
|
||||
auto _websocket_tls_server = std::make_shared<fc::http::websocket_tls_server>(cert_pem, "");
|
||||
if( options.count("rpc-tls-endpoint") )
|
||||
{
|
||||
_websocket_tls_server->on_connection([&]( const fc::http::websocket_connection_ptr& c ){
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(*c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
wsc->register_api(wapi);
|
||||
c->set_session_data( wsc );
|
||||
});
|
||||
ilog( "Listening for incoming TLS RPC requests on ${p}", ("p", options.at("rpc-tls-endpoint").as<string>() ));
|
||||
ilog( "Listening for incoming HTTPS and WSS RPC requests on ${p}",
|
||||
("p", options.at("rpc-tls-endpoint").as<string>()) );
|
||||
_websocket_tls_server->listen( fc::ip::endpoint::from_string(options.at("rpc-tls-endpoint").as<string>()) );
|
||||
_websocket_tls_server->start_accept();
|
||||
}
|
||||
|
||||
auto _http_server = std::make_shared<fc::http::server>();
|
||||
auto _http_ws_server = std::make_shared<fc::http::websocket_server>();
|
||||
if( options.count("rpc-http-endpoint" ) )
|
||||
{
|
||||
ilog( "Listening for incoming HTTP RPC requests on ${p}", ("p", options.at("rpc-http-endpoint").as<string>() ) );
|
||||
_http_server->listen( fc::ip::endpoint::from_string( options.at( "rpc-http-endpoint" ).as<string>() ) );
|
||||
//
|
||||
// due to implementation, on_request() must come AFTER listen()
|
||||
//
|
||||
_http_server->on_request(
|
||||
[&wapi]( const fc::http::request& req, const fc::http::server::response& resp )
|
||||
{
|
||||
std::shared_ptr< fc::rpc::http_api_connection > conn =
|
||||
std::make_shared< fc::rpc::http_api_connection >( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
conn->register_api( wapi );
|
||||
conn->on_request( req, resp );
|
||||
} );
|
||||
ilog( "Listening for incoming HTTP and WS RPC requests on ${p}",
|
||||
("p", options.at("rpc-http-endpoint").as<string>()) );
|
||||
_http_ws_server->on_connection([&wapi]( const fc::http::websocket_connection_ptr& c ){
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
wsc->register_api(wapi);
|
||||
c->set_session_data( wsc );
|
||||
});
|
||||
_http_ws_server->listen( fc::ip::endpoint::from_string(options.at("rpc-http-endpoint").as<string>()) );
|
||||
_http_ws_server->start_accept();
|
||||
}
|
||||
|
||||
if( !options.count( "daemon" ) )
|
||||
|
|
|
|||
Loading…
Reference in a new issue