Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge 5531afe into 5873328
Browse files Browse the repository at this point in the history
  • Loading branch information
navillasa committed Mar 1, 2018
2 parents 5873328 + 5531afe commit 93ef091
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/renter.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,17 @@ Renter.prototype._recordResponseTime = function(nodeID,
return;
}

// Changes spaceAvailable to false if contacts not seen in 24 hours
// so they stop receiving ALLOC messages
if (contact.lastSeen < new Date(Date.now() - 864e5)) {
contact.update({_id: nodeID}, {$set: {spaceAvailable: false}}, (err) => {
if (err) {
this._logger.warn('_recordResponseTime: Error setting contact %s ' +
'to spaceAvailable false', nodeID);
}
});
}

// Update reputation points
contact.recordPoints(repPoints);

Expand Down Expand Up @@ -636,7 +647,7 @@ Renter.prototype._publishContract = function(contacts, contract, callback) {
userAgent: contact.userAgent,
address: contact.address,
port: contact.port,
lastSeen: contact.lastSeen
lastSeen: contact.lastSeen,
});

const startTime = Date.now();
Expand Down

0 comments on commit 93ef091

Please sign in to comment.