void session::get_data(const std::error_code& ec, const get_data_type& packet, channel_ptr node) { if (ec) { log_error(LOG_SESSION) << "get_data: " << ec.message(); return; } // simple stuff node->subscribe_get_data( std::bind(&session::get_data, this, _1, _2, node)); }
void getx_responder::monitor(channel_ptr node) { // Use this wrapper to add shared state to our node for inv // requests to trigger getblocks requests so a node can continue // downloading blocks. channel_with_state special; special.node = node; // Serve tx and blocks to nodes. BITCOIN_ASSERT(node); node->subscribe_get_data( std::bind(&getx_responder::receive_get_data, this, _1, _2, special)); }
void session::new_channel(const std::error_code& ec, channel_ptr node) { if (ec) { log_warning(LOG_SESSION) << "New channel: " << ec.message(); return; } BITCOIN_ASSERT(node); node->subscribe_inventory( std::bind(&session::inventory, this, _1, _2, node)); node->subscribe_get_data( std::bind(&session::get_data, this, _1, _2, node)); node->subscribe_get_blocks( std::bind(&session::get_blocks, this, _1, _2, node)); // tx // block protocol_.subscribe_channel( std::bind(&session::new_channel, this, _1, _2)); poll_.monitor(node); }