aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/network/messages.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/network/messages.go')
-rw-r--r--swarm/network/messages.go23
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