Skip to content

Commit

Permalink
hew closer to security/master version of these lines
Browse files Browse the repository at this point in the history
  • Loading branch information
exarkun committed Dec 6, 2021
1 parent a8bdb8d commit 5f6579d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/allmydata/storage/server.py
Expand Up @@ -334,9 +334,8 @@ def _allocate_buckets(self, storage_index,
# file, they'll want us to hold leases for this file.
for (shnum, fn) in self._get_bucket_shares(storage_index):
alreadygot[shnum] = ShareFile(fn)
if renew_leases:
sf = ShareFile(fn)
sf.add_or_renew_lease(remaining_space, lease_info)
if renew_leases:
self._add_or_renew_leases(alreadygot.values(), lease_info)

for shnum in sharenums:
incominghome = os.path.join(self.incomingdir, si_dir, "%d" % shnum)
Expand Down Expand Up @@ -409,8 +408,10 @@ def remote_add_lease(self, storage_index, renew_secret, cancel_secret,
lease_info = LeaseInfo(owner_num,
renew_secret, cancel_secret,
new_expire_time, self.my_nodeid)
for sf in self._iter_share_files(storage_index):
sf.add_or_renew_lease(self.get_available_space(), lease_info)
self._add_or_renew_leases(
self._iter_share_files(storage_index),
lease_info,
)
self.add_latency("add-lease", self._clock.seconds() - start)
return None

Expand Down

0 comments on commit 5f6579d

Please sign in to comment.