From dd36202e74262b551588e88063e982ecf6bcd4f2 Mon Sep 17 00:00:00 2001 From: elmato Date: Fri, 27 Jan 2017 05:38:16 +0000 Subject: [PATCH] Replace the call to get_api_by_name with a direct call to the functions that return fc::api<> in the login_api. If the call to any of this functions succeed (because they where previously enabled), the api will auto-register itself in the websocket_api_connection/http_api_connection and will return an api_id_type. --- src/rpc/http_api.cpp | 4 +--- src/rpc/websocket_api.cpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/rpc/http_api.cpp b/src/rpc/http_api.cpp index 281febd..c9571a2 100644 --- a/src/rpc/http_api.cpp +++ b/src/rpc/http_api.cpp @@ -17,9 +17,7 @@ http_api_connection::http_api_connection() api_id_type api_id; if( args[0].is_string() ) { - variants subargs; - subargs.push_back( args[0] ); - variant subresult = this->receive_call( 1, "get_api_by_name", subargs ); + variant subresult = this->receive_call( 1, args[0].as_string() ); api_id = subresult.as_uint64(); } else diff --git a/src/rpc/websocket_api.cpp b/src/rpc/websocket_api.cpp index 6342b6f..3c6efef 100644 --- a/src/rpc/websocket_api.cpp +++ b/src/rpc/websocket_api.cpp @@ -16,9 +16,7 @@ websocket_api_connection::websocket_api_connection( fc::http::websocket_connecti api_id_type api_id; if( args[0].is_string() ) { - variants subargs; - subargs.push_back( args[0] ); - variant subresult = this->receive_call( 1, "get_api_by_name", subargs ); + variant subresult = this->receive_call( 1, args[0].as_string() ); api_id = subresult.as_uint64(); } else