cache incoming zeroconf connections. fixes #3561
This commit is contained in:
parent
6c5f65ddf0
commit
63d0bc54ec
1 changed files with 10 additions and 1 deletions
|
@ -79,7 +79,16 @@ class ZeroconfListener(IdleObject):
|
||||||
def pollin(self):
|
def pollin(self):
|
||||||
''' accept a new incomming connection and notify queue'''
|
''' accept a new incomming connection and notify queue'''
|
||||||
sock = self.accept_conn()
|
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):
|
def disconnect(self):
|
||||||
''' free all resources, we are not listening anymore '''
|
''' free all resources, we are not listening anymore '''
|
||||||
|
|
Loading…
Add table
Reference in a new issue