网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

EOS代码分析6P2P主动握手过程-创新互联

主动链接对端
connect( seed_node ); 链接peer节点
if (start_session( c )) { c->send_handshake (); //发送握手协议 }
c->send_handshake (); //初始化结构体,发送握手协议,协议最后要enqueue
handshake_initializer::populate
queue_write(); 发送缓冲过去[发送缓冲后,如何把缓冲发送过去?]

成都创新互联公司专注于崇义企业网站建设,成都响应式网站建设公司,商城网站开发。崇义网站建设公司,为崇义等地区提供建站服务。全流程定制网站设计,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务

主动发送的握手数据内容
void
handshake_initializer::populate( handshake_message &hello) {
hello.network_version = net_version_base + net_version;
hello.chain_id = my_impl->chain_id; //系统选项可以设定
hello.node_id = my_impl->node_id;
hello.key = my_impl->get_authentication_key(); //公钥
hello.time = std::chrono::system_clock::now().time_since_epoch().count();
hello.token = fc::sha256::hash(hello.time);
hello.sig = my_impl->sign_compact(hello.key, hello.token);
// If we couldn't sign, don't send a token.
if(hello.sig == chain::signature_type())
hello.token = sha256();
hello.p2p_address = my_impl->p2p_address + " - " + hello.node_id.str().substr(0,7);
#if defined( APPLE )
hello.os = "osx";
#elif defined( linux )
hello.os = "linux";
#elif defined( _MSC_VER )
hello.os = "win32";
#else
hello.os = "other";
#endif
hello.agent = my_impl->user_agent_name;

  controller& cc = my_impl->chain_plug->chain();
  hello.head_id = fc::sha256();
  hello.last_irreversible_block_id = fc::sha256();
  hello.head_num = cc.head_block_num();
  hello.last_irreversible_block_num = cc.last_irreversible_block_num();
  if( hello.last_irreversible_block_num ) {
     try {
        hello.last_irreversible_block_id = cc.get_block_id_for_num(hello.last_irreversible_block_num);
     }
     catch( const unknown_block_exception &ex) {
        ilog("caught unkown_block");
        hello.last_irreversible_block_num = 0;
     }
  }
  if( hello.head_num ) {
     try {
        hello.head_id = cc.get_block_id_for_num( hello.head_num );
     }
     catch( const unknown_block_exception &ex) {
       hello.head_num = 0;
     }
  }

}

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


标题名称:EOS代码分析6P2P主动握手过程-创新互联
网站地址:http://bjjierui.cn/article/jespc.html

其他资讯