diff options
author | Felix Lange <fjl@twurst.com> | 2015-04-13 23:44:14 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-04-13 23:44:14 +0800 |
commit | b8aeb04f6f55b03edb6998107f8480031e23b22f (patch) | |
tree | 70ff670712778760f7dff502829f56009c0ebfe9 | |
parent | b9929d289df8efd68e9226fc35b14cd5d469c6e8 (diff) | |
download | dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.tar dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.tar.gz dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.tar.bz2 dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.tar.lz dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.tar.xz dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.tar.zst dexon-b8aeb04f6f55b03edb6998107f8480031e23b22f.zip |
p2p/discover: remove unused field Node.activeStamp
-rw-r--r-- | p2p/discover/node.go | 15 | ||||
-rw-r--r-- | p2p/discover/table.go | 1 |
2 files changed, 0 insertions, 16 deletions
diff --git a/p2p/discover/node.go b/p2p/discover/node.go index 99cb549a5..6662a6cb7 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -14,8 +14,6 @@ import ( "strconv" "strings" "sync" - "sync/atomic" - "time" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/secp256k1" @@ -31,9 +29,6 @@ type Node struct { DiscPort int // UDP listening port for discovery protocol TCPPort int // TCP listening port for RLPx - - // this must be set/read using atomic load and store. - activeStamp int64 } func newNode(id NodeID, addr *net.UDPAddr) *Node { @@ -50,16 +45,6 @@ func (n *Node) isValid() bool { return !n.IP.IsMulticast() && !n.IP.IsUnspecified() && n.TCPPort != 0 && n.DiscPort != 0 } -func (n *Node) bumpActive() { - stamp := time.Now().Unix() - atomic.StoreInt64(&n.activeStamp, stamp) -} - -func (n *Node) active() time.Time { - stamp := atomic.LoadInt64(&n.activeStamp) - return time.Unix(stamp, 0) -} - func (n *Node) addr() *net.UDPAddr { return &net.UDPAddr{IP: n.IP, Port: n.DiscPort} } diff --git a/p2p/discover/table.go b/p2p/discover/table.go index dbf86c084..e2e846456 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -326,7 +326,6 @@ outer: func (b *bucket) bump(n *Node) bool { for i := range b.entries { if b.entries[i].ID == n.ID { - n.bumpActive() // move it to the front copy(b.entries[1:], b.entries[:i]) b.entries[0] = n |