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

Commit

Permalink
Merge pull request #92 from nat-ventura/update-lastSeen
Browse files Browse the repository at this point in the history
sets spaceAvailable false if ALLOCs fail and contact not seen in 24h
  • Loading branch information
braydonf committed Mar 2, 2018
2 parents 5873328 + e160e40 commit 2214a87
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/renter.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@ Renter.prototype._recordResponseTime = function(nodeID,
return;
}

// Updates spaceAvailable if contact not seen in 24 hours
if (contact.lastSeen < new Date(Date.now() - 864e5)) {
contact.spaceAvailable = false;
}

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

Expand Down Expand Up @@ -636,7 +641,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 2214a87

Please sign in to comment.