diff --git a/p2p/Buddy.py b/p2p/Buddy.py index b26bfb90..81d23976 100644 --- a/p2p/Buddy.py +++ b/p2p/Buddy.py @@ -31,8 +31,7 @@ class Owner(Buddy): if not nick or not len(nick): nick = "n00b" - service_name = nick + '.' + GROUP_SERVICE_TYPE - service = Service(service_name, '', '', GROUP_SERVICE_PORT) + service = Service(nick, '', '', GROUP_SERVICE_PORT) Buddy.__init__(self, service, nick) diff --git a/p2p/Group.py b/p2p/Group.py index c0672483..cb0e1d3e 100644 --- a/p2p/Group.py +++ b/p2p/Group.py @@ -67,11 +67,13 @@ class LocalGroup(Group): def _on_service_resolved(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags): - service = Service(name, host, address, port) - self._services[name] = service - if stype == BUDDY_SERVICE_TYPE: - data = self._pair_to_dict(avahi.txt_array_to_string_array(txt)) - self._add_buddy(service, data) + print name + if name != self._owner.get_service().get_name(): + service = Service(name, host, address, port) + self._services[name] = service + if stype == BUDDY_SERVICE_TYPE: + data = self._pair_to_dict(avahi.txt_array_to_string_array(txt)) + self._add_buddy(service, data) def _add_buddy(self, service, data): name = service.get_name() diff --git a/p2p/StreamReader.py b/p2p/StreamReader.py index dc5f2a6a..0517acb5 100644 --- a/p2p/StreamReader.py +++ b/p2p/StreamReader.py @@ -37,5 +37,7 @@ class StreamReader: self._recv(msg['addr'], msg['data']) def _recv(self, address, data): - buddy = self._group.get_buddy_from_address(address) - self._callback(buddy, data) + owner = self._group.get_owner() + if address != owner.get_service().get_address(): + buddy = self._group.get_buddy_from_address(address) + self._callback(buddy, data)