reconnection timeout++ and fix

This commit is contained in:
ingvar1995 2016-09-15 00:21:06 +03:00
parent 42e0ec005b
commit 337601f2a1
2 changed files with 7 additions and 4 deletions

View file

@ -78,8 +78,7 @@ class FileTransfer(QtCore.QObject):
t = ((time() - self._creation_time) / percentage) * (1 - percentage) t = ((time() - self._creation_time) / percentage) * (1 - percentage)
self._state_changed.signal.emit(self.state, percentage, int(t)) self._state_changed.signal.emit(self.state, percentage, int(t))
def finished(self, emit=False): def finished(self):
if type(self) is not ReceiveAvatar or emit:
self._finished.signal.emit(self._friend_number, self._file_number) self._finished.signal.emit(self._friend_number, self._file_number)
def get_file_number(self): def get_file_number(self):
@ -342,3 +341,7 @@ class ReceiveAvatar(ReceiveTransfer):
remove(avatar_path) remove(avatar_path)
rename(self._path, avatar_path) rename(self._path, avatar_path)
self.finished(True) self.finished(True)
def finished(self, emit=False):
if emit:
super().finished()

View file

@ -838,7 +838,7 @@ class Profile(contact.Contact, Singleton):
def reconnect(self): def reconnect(self):
if self.status is None or all(list(map(lambda x: x.status is None, self._friends))): if self.status is None or all(list(map(lambda x: x.status is None, self._friends))):
self.reset(self._screen.reset) self.reset(self._screen.reset)
QtCore.QTimer.singleShot(30000, self.reconnect) QtCore.QTimer.singleShot(45000, self.reconnect)
def close(self): def close(self):
for friend in self._friends: for friend in self._friends: