Add object wrappers to file server return

This commit is contained in:
Thomas S Hatch 2011-05-22 17:27:28 -06:00
parent 55edae3a29
commit 3d345c41e8
2 changed files with 5 additions and 4 deletions

View File

@ -343,7 +343,8 @@ class MWorker(multiprocessing.Process):
return '' return ''
fn_ = open(path, 'rb') fn_ = open(path, 'rb')
fn_.seek(load['loc']) fn_.seek(load['loc'])
return self.crypticle.dumps(fn_.read(self.opts['file_buffer_size'])) data = {'data': fn_.read(self.opts['file_buffer_size'])}
return self.crypticle.dumps(data)
def _file_hash(self, load): def _file_hash(self, load):
''' '''

View File

@ -120,10 +120,10 @@ def cache_file(path):
load['loc'] = fn_.tell() load['loc'] = fn_.tell()
payload['load'] = auth.crypticle.dumps(load) payload['load'] = auth.crypticle.dumps(load)
socket.send_pyobj(payload) socket.send_pyobj(payload)
data = auth.crypticle.dumps(socket.recv()) data = auth.crypticle.loads(socket.recv())
if not data: if not data['data']:
break break
fn_.write(data) fn_.write(data['data'])
return dest return dest
else: else:
return False return False