diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py index 92d25a6f1..ff9308162 100644 --- a/src/common/zeroconf/client_zeroconf.py +++ b/src/common/zeroconf/client_zeroconf.py @@ -79,7 +79,16 @@ class ZeroconfListener(IdleObject): def pollin(self): ''' accept a new incomming connection and notify queue''' sock = self.accept_conn() - P2PClient(sock[0], sock[1][0], sock[1][1], self.conn_holder) + ''' loop through roster to find who has connected to us''' + from_jid = None + nameinfo = socket.getnameinfo(sock[1], 0) + ipaddr = socket.gethostbyname(nameinfo[0]) + for jid in self.conn_holder.getRoster().keys(): + entry = self.conn_holder.getRoster().getItem(jid) + if (entry['address'] == ipaddr): + from_jid = jid + break; + P2PClient(sock[0], sock[1][0], sock[1][1], self.conn_holder, [], from_jid) def disconnect(self): ''' free all resources, we are not listening anymore '''