From 452f0abfd598240cfe290438ac9bb3525d7ee83d Mon Sep 17 00:00:00 2001 From: Sonic Date: Thu, 31 Jan 2019 19:40:39 +0800 Subject: p2p, dex: rework connection management (#183) * p2p, dex: rework connection management * dex: refresh our node record periodically * dex: don't send new record event if no new record --- dex/nodetable.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dex/nodetable.go') diff --git a/dex/nodetable.go b/dex/nodetable.go index 12cc9ba46..ba1c28994 100644 --- a/dex/nodetable.go +++ b/dex/nodetable.go @@ -52,7 +52,9 @@ func (t *nodeTable) AddRecords(records []*enr.Record) { log.Debug("Add new record to node table", "id", node.ID().String(), "ip", node.IP().String(), "udp", node.UDP(), "tcp", node.TCP()) } - t.feed.Send(newRecordsEvent{newRecords}) + if len(newRecords) > 0 { + go t.feed.Send(newRecordsEvent{newRecords}) + } } func (t *nodeTable) Records() []*enr.Record { -- cgit