Add refresh file list in download method.
This commit is contained in:
parent
f799119a69
commit
42e40a535c
1 changed files with 6 additions and 2 deletions
|
@ -80,9 +80,13 @@ class Peer(MessageServer):
|
|||
return self._file_list
|
||||
|
||||
def download(self, file, destination, progress):
|
||||
if file not in self._file_list.keys():
|
||||
# refresh the file list
|
||||
self.list_file()
|
||||
# still not in list
|
||||
if file not in self._file_list.keys():
|
||||
return False, 'Requested file {} does not exist'.format(file)
|
||||
return True, 'File {} dowloaded to {} completed'.format(file, destination)
|
||||
return True, 'File {} dowloaded to {}'.format(file, destination)
|
||||
|
||||
def _server_started(self):
|
||||
logger.info('Requesting to register')
|
||||
|
|
Loading…
Reference in a new issue