兄弟连区块链入门教程eth源码分析p2p-udp.go源码分析(二)
ping方法与pending的处理,之前谈到了pending是等待一个reply。 这里通过代码来分析是如何实现等待reply的。pending方法把pending结构体发送给addpending. 然后等待消息的处理和接收。 // ping sends a ping message to the given node and waits for a reply. func (t *udp) ping(toid NodeID, toaddr *net.UDPAddr) error { // TODO: maybe check for ReplyTo field in callback to measure RTT errc := t.pending(toid, pongPacket, fun...阅读全文