void handshake::ready(channel_ptr node, handshake::handshake_handler handle_handshake) { auto completion_callback = async_parallel(handle_handshake, 3); version_type session_version = template_version_; session_version.timestamp = time(NULL); node->send(session_version, strand_.wrap(std::bind(&handshake::handle_message_sent, this, _1, completion_callback))); node->subscribe_version( strand_.wrap(std::bind(&handshake::receive_version, this, _1, _2, node, completion_callback))); node->subscribe_verack( strand_.wrap(std::bind(&handshake::receive_verack, this, _1, _2, completion_callback))); }
void handshake::ready(channel_ptr node, handshake::handshake_handler handle_handshake) { atomic_counter_ptr counter = std::make_shared<atomic_counter>(0); version_type session_version = template_version_; session_version.timestamp = time(NULL); node->send(session_version, strand_.wrap(std::bind(&handshake::handle_message_sent, this, _1, counter, handle_handshake))); node->subscribe_version( strand_.wrap(std::bind(&handshake::receive_version, this, _1, _2, node, counter, handle_handshake))); node->subscribe_verack( strand_.wrap(std::bind(&handshake::receive_verack, this, _1, _2, counter, handle_handshake))); }