Ejemplo n.º 1
0
    def __init__(self):
        ShmTable.__init__(self, 576)
        self.tokens = {}  # token => url
        self.used_tokens = []  # used throw here - delete when appropriate
        self.active_queue = [
        ]  # add everything here. After size grows to some point, start
        # deleting also active unused yed tokens

        self.delete_used_threshold = 5  # 1 means immediately
        self.delete_active_threshold = 200  # mark oldest tokens above this margin as used
Ejemplo n.º 2
0
    def on_new_entry(self, blob):
        ShmTable.on_new_entry(self, blob)
        t, u = struct.unpack('64s512s', blob)

        t_i = t.find('\x00', 0, 512)
        u_i = u.find('\x00', 0, 512)
        tt = t[:t_i]
        uu = u[:u_i]

        flog.debug("TokenTable::on_new_entry: " + tt + ":" + uu)
        self.tokens[tt] = uu
        self.life_queue(tt)
Ejemplo n.º 3
0
 def __init__(self,ip_version=4):
     ShmTable.__init__(self,4+64+128)
     self.logons = {}
     self.normalizing = True
     self.ip_version = ip_version
     
     
     # initialize properly row_size in ShmTable
     if self.ip_version == 4:
         self.row_size = 4+64+128
     elif self.ip_version == 6:
         self.row_size = 16+64+128
     else:
         raise Exception("incorrect IP protocol version")
Ejemplo n.º 4
0
 def on_new_table(self):
     ShmTable.on_new_table(self)
     self.tokens = {}