diff options
author | Egon Elbre <egonelbre@gmail.com> | 2017-08-09 01:34:35 +0800 |
---|---|---|
committer | Egon Elbre <egonelbre@gmail.com> | 2017-08-14 23:12:37 +0800 |
commit | 133de3d80659680dc051065cb3baddd92a4e45c5 (patch) | |
tree | cc67ede99634e335f8a07a5b0b084877cb8282d7 /swarm/network/messages.go | |
parent | 6ca59d98f88d4b4cc8bdeb2f023ff8c1fa228c6f (diff) | |
download | go-tangerine-133de3d80659680dc051065cb3baddd92a4e45c5.tar.gz go-tangerine-133de3d80659680dc051065cb3baddd92a4e45c5.tar.zst go-tangerine-133de3d80659680dc051065cb3baddd92a4e45c5.zip |
swarm: fix megacheck warnings
Diffstat (limited to 'swarm/network/messages.go')
-rw-r--r-- | swarm/network/messages.go | 23 |
1 files changed, 7 insertions, 16 deletions
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 |