mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-10 05:53:46 +00:00
add waitinit
Signed-off-by: Chen Kai <281165273grape@gmail.com>
This commit is contained in:
parent
5095282864
commit
0f8cc5fcd2
2 changed files with 10 additions and 0 deletions
|
|
@ -695,6 +695,11 @@ func pushNode(list []*tableNode, n *tableNode, max int) ([]*tableNode, *tableNod
|
||||||
return list, removed
|
return list, removed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// waitInit waits until the table is initialized.
|
||||||
|
func (tab *Table) waitInit() {
|
||||||
|
<-tab.initDone
|
||||||
|
}
|
||||||
|
|
||||||
// nodeList returns all nodes contained in the table.
|
// nodeList returns all nodes contained in the table.
|
||||||
func (tab *Table) nodeList() []*enode.Node {
|
func (tab *Table) nodeList() []*enode.Node {
|
||||||
if !tab.isInitDone() {
|
if !tab.isInitDone() {
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,11 @@ func (t *UDPv5) DeleteNode(n *enode.Node) {
|
||||||
t.tab.deleteNode(n)
|
t.tab.deleteNode(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WaitInit waits for the routing table to be initialized.
|
||||||
|
func (t *UDPv5) WaitInit() {
|
||||||
|
t.tab.waitInit()
|
||||||
|
}
|
||||||
|
|
||||||
// LocalNode returns the current local Node running the
|
// LocalNode returns the current local Node running the
|
||||||
// protocol.
|
// protocol.
|
||||||
func (t *UDPv5) LocalNode() *enode.LocalNode {
|
func (t *UDPv5) LocalNode() *enode.LocalNode {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue