aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/network
diff options
context:
space:
mode:
authorEgon Elbre <egonelbre@gmail.com>2017-08-09 01:34:35 +0800
committerEgon Elbre <egonelbre@gmail.com>2017-08-14 23:12:37 +0800
commit133de3d80659680dc051065cb3baddd92a4e45c5 (patch)
treecc67ede99634e335f8a07a5b0b084877cb8282d7 /swarm/network
parent6ca59d98f88d4b4cc8bdeb2f023ff8c1fa228c6f (diff)
downloaddexon-133de3d80659680dc051065cb3baddd92a4e45c5.tar
dexon-133de3d80659680dc051065cb3baddd92a4e45c5.tar.gz
dexon-133de3d80659680dc051065cb3baddd92a4e45c5.tar.bz2
dexon-133de3d80659680dc051065cb3baddd92a4e45c5.tar.lz
dexon-133de3d80659680dc051065cb3baddd92a4e45c5.tar.xz
dexon-133de3d80659680dc051065cb3baddd92a4e45c5.tar.zst
dexon-133de3d80659680dc051065cb3baddd92a4e45c5.zip
swarm: fix megacheck warnings
Diffstat (limited to 'swarm/network')
-rw-r--r--swarm/network/hive.go2
-rw-r--r--swarm/network/messages.go23
-rw-r--r--swarm/network/protocol.go3
-rw-r--r--swarm/network/syncer.go3
4 files changed, 9 insertions, 22 deletions
diff --git a/swarm/network/hive.go b/swarm/network/hive.go
index 70652c450..d37b7e400 100644
--- a/swarm/network/hive.go
+++ b/swarm/network/hive.go
@@ -355,7 +355,7 @@ func saveSync(record *kademlia.NodeRecord, node kademlia.Node) {
// sends relevant peer data given by the kademlia hive to the requester
// TODO: remember peers sent for duration of the session, only new peers sent
func (self *Hive) peers(req *retrieveRequestMsgData) {
- if req != nil && req.MaxPeers >= 0 {
+ if req != nil {
var addrs []*peerAddr
if req.timeout == nil || time.Now().Before(*(req.timeout)) {
key := req.Key
diff --git a/swarm/network/messages.go b/swarm/network/messages.go
index d3858c424..d920def95 100644
--- a/swarm/network/messages.go
+++ b/swarm/network/messages.go
@@ -133,7 +133,7 @@ type retrieveRequestMsgData struct {
from *peer //
}
-func (self retrieveRequestMsgData) String() string {
+func (self *retrieveRequestMsgData) String() string {
var from string
if self.from == nil {
from = "ourselves"
@@ -148,12 +148,12 @@ func (self retrieveRequestMsgData) String() string {
}
// lookups are encoded by missing request ID
-func (self retrieveRequestMsgData) isLookup() bool {
+func (self *retrieveRequestMsgData) isLookup() bool {
return self.Id == 0
}
// sets timeout fields
-func (self retrieveRequestMsgData) setTimeout(t *time.Time) {
+func (self *retrieveRequestMsgData) setTimeout(t *time.Time) {
self.timeout = t
if t != nil {
self.Timeout = uint64(t.UnixNano())
@@ -162,7 +162,7 @@ func (self retrieveRequestMsgData) setTimeout(t *time.Time) {
}
}
-func (self retrieveRequestMsgData) getTimeout() (t *time.Time) {
+func (self *retrieveRequestMsgData) getTimeout() (t *time.Time) {
if self.Timeout > 0 && self.timeout == nil {
timeout := time.Unix(int64(self.Timeout), 0)
t = &timeout
@@ -180,7 +180,7 @@ type peerAddr struct {
}
// peerAddr pretty prints as enode
-func (self peerAddr) String() string {
+func (self *peerAddr) String() string {
var nodeid discover.NodeID
copy(nodeid[:], self.ID)
return discover.NewNode(nodeid, self.IP, 0, self.Port).String()
@@ -213,7 +213,7 @@ type peersMsgData struct {
}
// peers msg pretty printer
-func (self peersMsgData) String() string {
+func (self *peersMsgData) String() string {
var from string
if self.from == nil {
from = "ourselves"
@@ -227,7 +227,7 @@ func (self peersMsgData) String() string {
return fmt.Sprintf("from: %v, Key: %x; ID: %v, Peers: %v", from, target, self.Id, self.Peers)
}
-func (self peersMsgData) setTimeout(t *time.Time) {
+func (self *peersMsgData) setTimeout(t *time.Time) {
self.timeout = t
if t != nil {
self.Timeout = uint64(t.UnixNano())
@@ -236,15 +236,6 @@ func (self peersMsgData) setTimeout(t *time.Time) {
}
}
-func (self peersMsgData) getTimeout() (t *time.Time) {
- if self.Timeout > 0 && self.timeout == nil {
- timeout := time.Unix(int64(self.Timeout), 0)
- t = &timeout
- self.timeout = t
- }
- return
-}
-
/*
syncRequest
diff --git a/swarm/network/protocol.go b/swarm/network/protocol.go
index d013b3109..2f880df57 100644
--- a/swarm/network/protocol.go
+++ b/swarm/network/protocol.go
@@ -40,7 +40,6 @@ import (
"github.com/ethereum/go-ethereum/contracts/chequebook"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
- "github.com/ethereum/go-ethereum/p2p/discover"
bzzswap "github.com/ethereum/go-ethereum/swarm/services/swap"
"github.com/ethereum/go-ethereum/swarm/services/swap/swap"
"github.com/ethereum/go-ethereum/swarm/storage"
@@ -56,8 +55,6 @@ const (
// bzz represents the swarm wire protocol
// an instance is running on each peer
type bzz struct {
- selfID discover.NodeID // peer's node id used in peer advertising in handshake
- key storage.Key // baseaddress as storage.Key
storage StorageHandler // handler storage/retrieval related requests coming via the bzz wire protocol
hive *Hive // the logistic manager, peerPool, routing service and peer handler
dbAccess *DbAccess // access to db storage counter and iterator for syncing
diff --git a/swarm/network/syncer.go b/swarm/network/syncer.go
index 20129c2a8..a3814e423 100644
--- a/swarm/network/syncer.go
+++ b/swarm/network/syncer.go
@@ -156,8 +156,7 @@ type syncer struct {
quit chan bool // signal to quit loops
// DB related fields
- dbAccess *DbAccess // access to dbStore
- db *storage.LDBDatabase // delivery msg db
+ dbAccess *DbAccess // access to dbStore
// native fields
queues [priorities]*syncDb // in-memory cache / queues for sync reqs