aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/node.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-28 18:40:10 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-28 18:40:10 +0800
commit91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470 (patch)
tree35f36ea4a2cbc68a5b0410e4367d485db3ffe545 /p2p/discover/node.go
parente88b410b4d25c65b023b4ee7b4d1bc5dbc4dab93 (diff)
parent4992765032b4318f3f5b4940a553b4e552c55963 (diff)
downloadgo-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.tar
go-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.tar.gz
go-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.tar.bz2
go-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.tar.lz
go-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.tar.xz
go-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.tar.zst
go-tangerine-91cb8cdd2acdcaceb577fd0ea9eb0997d42f8470.zip
Merge pull request #793 from karalabe/discovery-node-cache
p2p/discover: persistent node database
Diffstat (limited to 'p2p/discover/node.go')
-rw-r--r--p2p/discover/node.go24
1 files changed, 0 insertions, 24 deletions
diff --git a/p2p/discover/node.go b/p2p/discover/node.go
index 6662a6cb7..e66ca37a4 100644
--- a/p2p/discover/node.go
+++ b/p2p/discover/node.go
@@ -13,7 +13,6 @@ import (
"net/url"
"strconv"
"strings"
- "sync"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
@@ -305,26 +304,3 @@ func randomID(a NodeID, n int) (b NodeID) {
}
return b
}
-
-// nodeDB stores all nodes we know about.
-type nodeDB struct {
- mu sync.RWMutex
- byID map[NodeID]*Node
-}
-
-func (db *nodeDB) get(id NodeID) *Node {
- db.mu.RLock()
- defer db.mu.RUnlock()
- return db.byID[id]
-}
-
-func (db *nodeDB) add(id NodeID, addr *net.UDPAddr, tcpPort uint16) *Node {
- db.mu.Lock()
- defer db.mu.Unlock()
- if db.byID == nil {
- db.byID = make(map[NodeID]*Node)
- }
- n := &Node{ID: id, IP: addr.IP, DiscPort: addr.Port, TCPPort: int(tcpPort)}
- db.byID[n.ID] = n
- return n
-}