mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-26 03:28:17 +00:00
Just do whole thing in one thread job
This commit is contained in:
parent
7f53f40d76
commit
5d896e8035
@ -729,18 +729,17 @@ class Publish(object):
|
||||
|
||||
assert len(data) == segsize, len(data)
|
||||
|
||||
salt = os.urandom(16)
|
||||
|
||||
key = await defer_to_thread(hashutil.ssk_readkey_data_hash, salt, self.readkey)
|
||||
self._status.set_status("Encrypting")
|
||||
|
||||
def encrypt():
|
||||
def encrypt(readkey):
|
||||
salt = os.urandom(16)
|
||||
key = hashutil.ssk_readkey_data_hash(salt, readkey)
|
||||
encryptor = aes.create_encryptor(key)
|
||||
crypttext = aes.encrypt_data(encryptor, data)
|
||||
assert len(crypttext) == len(data)
|
||||
return crypttext
|
||||
return salt, crypttext
|
||||
|
||||
crypttext = await defer_to_thread(encrypt)
|
||||
salt, crypttext = await defer_to_thread(encrypt, self.readkey)
|
||||
|
||||
now = time.time()
|
||||
self._status.accumulate_encrypt_time(now - started)
|
||||
|
Loading…
x
Reference in New Issue
Block a user