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 ''
fn_ = open(path, 'rb')
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):
'''

View File

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