Changeset 8976

Show
Ignore:
Timestamp:
11/16/07 09:41:24 (13 months ago)
Author:
asterix
Message:

cache incoming zeroconf connections. fixes #3561

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/zeroconf/client_zeroconf.py

    r8926 r8976  
    8080                ''' accept a new incomming connection and notify queue''' 
    8181                sock = self.accept_conn() 
    82                 P2PClient(sock[0], sock[1][0], sock[1][1], self.conn_holder) 
     82                ''' loop through roster to find who has connected to us''' 
     83                from_jid = None 
     84                nameinfo = socket.getnameinfo(sock[1], 0) 
     85                ipaddr = socket.gethostbyname(nameinfo[0]) 
     86                for jid in self.conn_holder.getRoster().keys(): 
     87                        entry = self.conn_holder.getRoster().getItem(jid) 
     88                        if (entry['address'] == ipaddr): 
     89                                from_jid = jid 
     90                                break; 
     91                P2PClient(sock[0], sock[1][0], sock[1][1], self.conn_holder, [], from_jid) 
    8392         
    8493        def disconnect(self):