Changeset 1634

Show
Ignore:
Timestamp:
11/18/08 11:36:32 (2 months ago)
Author:
peet
Message:

link watchdogs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.4.7/lib/cxcore/cxcore/cxnetlink.py

    r1633 r1634  
    551551                        return 
    552552 
     553                #for i in map(lambda x: x.name, self.mdns.lookupByIP(address)): 
     554                if self.watch.has_key(address): 
     555                                self.watch[address].state = "reachable" 
     556                                del self.watch[address] 
     557 
     558                ## watch flags 
     559                if (header.flags & CX_MSG_ECHO) and (header.flags & CX_FLAGS_FIRST_FRAGMENT): 
     560                        for i in map(lambda x: x.name, self.mdns.lookupByIP(address)): 
     561                                (host,prop,record) = self.mdns.lookup(i) 
     562                                self._send(host,None,record,0,CX_MSG_DROP) 
     563 
     564                if header.flags & CX_MSG_DROP: 
     565                        return 
     566 
    553567                # drop duplicates 
    554568                origin = self.mdns.lookupByIPPort(address,port) 
     
    568582                        self.log("debug","nonce for an origin incremented") 
    569583 
    570                 #for i in map(lambda x: x.name, self.mdns.lookupByIP(address)): 
    571                         #if self.watch.has_key(i): 
    572                                 #self.watch[i].state = "reachable" 
    573                                 #del self.watch[i] 
    574  
    575                         ## watch flags 
    576                         #if (header.flags & CX_MSG_ECHO) and (header.flags & CX_FLAGS_FIRST_FRAGMENT): 
    577                                 #(host,prop,record) = self.mdns.lookup(i) 
    578                                 #self._send(host,None,record,CX_MSG_DROP) 
    579  
    580                 #if header.flags & CX_MSG_DROP: 
    581                         #return 
    582  
    583584                # get plaintext message and load it 
    584585                self.hook(self.bus, self.recv_buffer, header.msg_len + sizeof(header), "cl_socket.recv()") 
     
    679680                                msg.header.alg_len = a 
    680681 
    681                         #if flags & CX_MSG_TRACK: 
    682                                 #self.watch[record.name] = record 
    683                                 #Timer(2,self.watchdog,(record.name,)).start() 
     682                        if flags & CX_MSG_TRACK: 
     683                                self.watch[host[0]] = record 
     684                                Timer(2,self.watchdog,(host[0],)).start() 
    684685 
    685686                        offset = 0 
    686687                        fragment = 1 
    687688                        while (offset < len(c)) and (fragment < CX_MAX_FRAGMENT): 
    688                                 msg.header.flags = 0 
     689                                msg.header.flags = flags 
    689690                                 
    690691                                if offset == 0: