From 5f6579d44622b0774aec8ba06b67f2d4f2ee7af7 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 6 Dec 2021 12:47:37 -0500 Subject: [PATCH] hew closer to security/master version of these lines --- src/allmydata/storage/server.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/allmydata/storage/server.py b/src/allmydata/storage/server.py index 9a9b3e624..80b337d36 100644 --- a/src/allmydata/storage/server.py +++ b/src/allmydata/storage/server.py @@ -334,9 +334,8 @@ class StorageServer(service.MultiService, Referenceable): # 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) @@ -409,8 +408,10 @@ class StorageServer(service.MultiService, Referenceable): 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