Esempio n. 1
0
 def handle_connect(self):
   self.keepalive()
   log.l.LogIt('RBC003', 'I', 'bnmroutc %s connected on port %s', (self.ip, self.getsockname()[1]))
   cfg.servers[self.ip]['routc'] = self
   self.msgbuf = []
   self.msgbuf.append(routc.heartBeat())
   # send all connected and status messages to this bnmroutc
   atms = cfg.atm.keys()
   for i in atms:
     dom = cfg.atm[i]['domain']
     if cfg.atm[i]['gastate'] == '=' or cfg.atm[i]['gastate'] == 'o' and \
        dom != '':
       ip = cfg.domain[dom]['server'][cfg.domain[dom]['active']]
       if ip == self.ip:
         cfg.servers[ip]['routc'].routcEvt(routc.atmConnect(dom, i))
         ga = cfg.atm[i]['gasock']
         if ga.tcpip:
           self.routcEvt(routc.ipAddr(dom, i, ga.peer_ip))
         else:
           self.routcEvt(routc.x25Addr(dom, i, ga.pvc))
           self.routcEvt(routc.x25Status(dom, i, ga.pvc,
                                    '%x'%(cfg.snaid[ga.pvc]['status'] & ~0x800)))
         if cfg.atm[i]['bnmstate'] == 'o':
           self.routcEvt(routc.bnmConnect(dom, i))
Esempio n. 2
0
 def routcHB(self):
   if time.time() - self.lasttime > routercfg.routc:
     self.msgbuf.append(routc.heartBeat())