File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ func (self *peer) Url() string {
294
294
295
295
// TODO take into account traffic
296
296
func (self * peer ) LastActive () time.Time {
297
- return time . Now ()
297
+ return self . lastActive
298
298
}
299
299
300
300
// reads the serialised form of sync state persisted as the 'Meta' attribute
@@ -335,9 +335,6 @@ func saveSync(record *kademlia.NodeRecord, node kademlia.Node) {
335
335
// sends relevant peer data given by the kademlia hive to the requester
336
336
// TODO: remember peers sent for duration of the session, only new peers sent
337
337
func (self * Hive ) peers (req * retrieveRequestMsgData ) {
338
- // FIXME: should check req.MaxPeers but then should not default to zero or make sure we set it when sending retrieveRequests
339
- // we might need chunk.req to cache relevant peers response,
340
- // hive change would expire it
341
338
if req != nil && req .MaxPeers >= 0 {
342
339
var addrs []* peerAddr
343
340
if req .timeout == nil || time .Now ().Before (* (req .timeout )) {
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ type bzz struct {
79
79
rw p2p.MsgReadWriter // messageReadWriter to send messages to
80
80
errors * errs.Errors // errors table
81
81
backend bind.Backend
82
+ lastActive time.Time
82
83
83
84
swap * swap.Swap // swap instance for the peer connection
84
85
swapParams * bzzswap.SwapParams // swap settings both local and remote
@@ -229,6 +230,8 @@ func (self *bzz) handle() error {
229
230
if len (req .SData ) < 9 {
230
231
return self .protoError (ErrDecode , "<- %v: Data too short (%v)" , msg )
231
232
}
233
+ // last Active time is set only when receiving chunks
234
+ self .lastActive = time .Now ()
232
235
glog .V (logger .Detail ).Infof ("[BZZ] incoming store request: %s" , req .String ())
233
236
// swap accounting is done within forwarding
234
237
self .storage .HandleStoreRequestMsg (& req , & peer {bzz : self })
You can’t perform that action at this time.
0 commit comments