diff options
author | Sonic <sonic@dexon.org> | 2019-01-31 19:40:39 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 452f0abfd598240cfe290438ac9bb3525d7ee83d (patch) | |
tree | 5993714f3c3bf3310f25a4f8d242174e617e05e8 /dex/nodetable.go | |
parent | 2be32e25545ff3bc322b1e5b55de4aa5d4d394a3 (diff) | |
download | dexon-452f0abfd598240cfe290438ac9bb3525d7ee83d.tar.gz dexon-452f0abfd598240cfe290438ac9bb3525d7ee83d.tar.zst dexon-452f0abfd598240cfe290438ac9bb3525d7ee83d.zip |
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
Diffstat (limited to 'dex/nodetable.go')
-rw-r--r-- | dex/nodetable.go | 4 |
1 files changed, 3 insertions, 1 deletions
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 { |