re-announce local node if username changes

This commit is contained in:
j 2016-04-05 09:57:34 +02:00
parent 9d1603cfb2
commit 0b2db6fd80

View file

@ -70,7 +70,8 @@ class LocalNodes(dict):
def _update_if_ip_changed(self): def _update_if_ip_changed(self):
local_ips = get_broadcast_interfaces() local_ips = get_broadcast_interfaces()
if local_ips != self.local_ips: username = settings.preferences.get('username', 'anonymous')
if local_ips != self.local_ips or self.username != username:
self.close() self.close()
self.setup() self.setup()
@ -88,8 +89,9 @@ class LocalNodes(dict):
local_name = socket.gethostname().partition('.')[0] + '.local.' local_name = socket.gethostname().partition('.')[0] + '.local.'
port = settings.server['node_port'] port = settings.server['node_port']
self.username = settings.preferences.get('username', 'anonymous')
desc = { desc = {
'username': settings.preferences.get('username', 'anonymous') 'username': self.username
} }
self.local_info = [] self.local_info = []
for i, local_ip in enumerate(get_broadcast_interfaces()): for i, local_ip in enumerate(get_broadcast_interfaces()):