reconnection - clear peers list

This commit is contained in:
ingvar1995 2018-07-21 17:16:01 +03:00
parent 6538cedcf2
commit 820b5a0253
2 changed files with 9 additions and 0 deletions

View file

@ -51,6 +51,9 @@ class GroupChat(contact.Contact, ToxSave):
return peers[0] return peers[0]
def remove_all_peers_except_self(self):
self._peers = self._peers[:1]
def get_peers(self): def get_peers(self):
return self._peers[:] return self._peers[:]

View file

@ -47,11 +47,13 @@ class GroupsService(tox_save.ToxSave):
self._tox.group_disconnect(group_number) self._tox.group_disconnect(group_number)
group = self._get_group(group_number) group = self._get_group(group_number)
group.status = None group.status = None
self._clear_peers_list(group)
def reconnect_to_group(self, group_number): def reconnect_to_group(self, group_number):
self._tox.group_reconnect(group_number) self._tox.group_reconnect(group_number)
group = self._get_group(group_number) group = self._get_group(group_number)
group.status = constants.TOX_USER_STATUS['NONE'] group.status = constants.TOX_USER_STATUS['NONE']
self._clear_peers_list(group)
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
# Group invites # Group invites
@ -102,3 +104,7 @@ class GroupsService(tox_save.ToxSave):
def _get_all_groups(self): def _get_all_groups(self):
return self._contacts_provider.get_all_groups() return self._contacts_provider.get_all_groups()
def _clear_peers_list(self, group):
group.remove_all_peers_except_self()
self.generate_peers_list()