Skip to content

Commit

Permalink
Increase reliability of folder search timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Nov 14, 2016
1 parent b8f06ef commit 1af4d69
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions syncplay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,7 @@ def _updateInfoThread(self):
startTime = time.time()
if os.path.isfile(os.path.join(directory, randomFilename)):
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt"
print "Found random file (?)"
if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT:
self.folderSearchEnabled = False
self.directorySearchError = getMessage("folder-search-first-file-timeout-error").format(directory)
Expand Down Expand Up @@ -1744,9 +1745,12 @@ def findFilepath(self, filename, highPriority=False):
startTime = time.time()
if os.path.isfile(os.path.join(directory, randomFilename)):
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt"
print "Found random file (?)"
if not self.folderSearchEnabled:
return
if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT:
self.folderSearchEnabled = False
self.directorySearchError = getMessage("folder-search-first-file-timeout-error").format(directory)
return

startTime = time.time()
Expand Down

0 comments on commit 1af4d69

Please sign in to comment.