cache incoming zeroconf connections. fixes #3561
This commit is contained in:
parent
6c5f65ddf0
commit
63d0bc54ec
|
@ -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 '''
|
||||
|
|
Loading…
Reference in New Issue