anycall/connectionpool.py
def send(self, peer, typename, data):
        """
        Sends a packet to a peer.
        """


        def attempt_to_send(_):
            if peer not in self._connections:
                d = self._connect(peer)
                d.addCallback(attempt_to_send)
                return d
            else:
                conn = self._connections[peer][0]
                conn.send_packet(typename, data)            
                return defer.succeed(None)
        
        d = attempt_to_send(None)
        
        self._ongoing_sends.add(d)
        
        def send_completed(result):
            if d in self._ongoing_sends:
                self._ongoing_sends.remove(d)
            return result
        
        d.addBoth(send_completed)
        return d
def send(self, peer, typename, data):
        def attempt_to_send(_):
            if peer not in self._connections:
                d = self._connect(peer)
                d.addCallback(attempt_to_send)
                return d
            else:
                conn = self._connections[peer][0]
                conn.send_packet(typename, data)            
                return defer.succeed(None)
        
        d = attempt_to_send(None)
        
        self._ongoing_sends.add(d)
        
        def send_completed(result):
            if d in self._ongoing_sends:
                self._ongoing_sends.remove(d)
            return result
        
        d.addBoth(send_completed)
        return d
def send ( self , peer , typename , data ) : def attempt_to_send ( _ ) : if peer not in self . _connections : d = self . _connect ( peer ) d . addCallback ( attempt_to_send ) return d else : conn = self . _connections [ peer ] [ 0 ] conn . send_packet ( typename , data ) return defer . succeed ( None ) d = attempt_to_send ( None ) self . _ongoing_sends . add ( d ) def send_completed ( result ) : if d in self . _ongoing_sends : self . _ongoing_sends . remove ( d ) return result d . addBoth ( send_completed ) return d
Sends a packet to a peer.
Sends a packet to a peer .