| 64 | } |
| 65 | |
| 66 | void delayed_node_plugin::connect() |
| 67 | { |
| 68 | fc::http::websocket_connection_ptr con; |
| 69 | try |
| 70 | { |
| 71 | con = my->client.connect(my->remote_endpoint); |
| 72 | } |
| 73 | catch( const fc::exception& e ) |
| 74 | { |
| 75 | wlog("Error while connecting: ${e}", ("e", e.to_detail_string())); |
| 76 | connection_failed(); |
| 77 | return; |
| 78 | } |
| 79 | my->client_connection = std::make_shared<fc::rpc::websocket_api_connection>( |
| 80 | con, GRAPHENE_NET_MAX_NESTED_OBJECTS ); |
| 81 | my->database_api = my->client_connection->get_remote_api<graphene::app::database_api>(0); |
| 82 | my->database_api->set_block_applied_callback([this]( const fc::variant& block_id ) |
| 83 | { |
| 84 | fc::from_variant( block_id, my->last_received_remote_head, GRAPHENE_MAX_NESTED_OBJECTS ); |
| 85 | } ); |
| 86 | my->client_connection_closed = my->client_connection->closed.connect([this] { |
| 87 | connection_failed(); |
| 88 | }); |
| 89 | } |
| 90 | |
| 91 | void delayed_node_plugin::plugin_initialize(const boost::program_options::variables_map& options) |
| 92 | { |
no test coverage detected