コード例 #1
0
ファイル: end.py プロジェクト: warner/pylehash
 def find(self, ipp):
     '''
     Tries to find the end for the given ipptup in our beckets. If it isn't
     there, it adds a new one.
     '''
     if self.switch.ipp:
         h = hash.hexhash(ipp)
         b = self.bucket_for(ipp)
         if h in b:
             e = b[h]
         else:
             e = End(ipp)
             self.add(e)
     else:
         e = End(ipp)
     return e
コード例 #2
0
ファイル: end.py プロジェクト: warner/pylehash
 def add(self, e):
     '''
     Adds the given end to our buckets iff an end isn't already there.
     '''
     if e.ipp != self.switch.ipp and not hash.hexhash(e.ipp) in self.bucket_for(e.ipp):
         self.bucket_for(e.ipp)[hash.hexhash(e.ipp)] = e
コード例 #3
0
ファイル: switch.py プロジェクト: warner/pylehash
def send_bootstrap_telex(switch):
    '''
    Sends an arbitrary bootstrap telex. Should be relocated, I believe.
    '''
    t = Telex(other_dict={'+end':hash.hexhash('1.2.3.4:5555')})
    switch.send(t, switch.ends.find(switch.seed_ipp))