예제 #1
0
파일: test_events.py 프로젝트: zhangrb/maas
 def test_makes_events_as_properties(self):
     events = [
         factory.make_name("event")
         for _ in range(3)
     ]
     group = EventGroup(*events)
     for event in events:
         self.expectThat(getattr(group, event), IsInstance(Event))
예제 #2
0
 def __init__(self, ipcWorker):
     super().__init__()
     self.ipcWorker = ipcWorker
     self.endpoints = [[
         TCP6ServerEndpoint(reactor, port) for port in range(5250, 5260)
     ]]
     self.connections = defaultdict(set)
     self.connectionsCache = defaultdict(dict)
     self.waiters = defaultdict(set)
     self.factory = Factory.forProtocol(RegionServer)
     self.factory.service = self
     self.ports = []
     self.events = EventGroup("connected", "disconnected")
예제 #3
0
파일: listener.py 프로젝트: tai271828/maas
 def __init__(self, alias="default"):
     self.alias = alias
     self.listeners = defaultdict(list)
     self.autoReconnect = False
     self.connection = None
     self.connectionFileno = None
     self.notifications = set()
     self.notifier = task.LoopingCall(self.handleNotifies)
     self.notifierDone = None
     self.connecting = None
     self.disconnecting = None
     self.registeredChannels = False
     self.log = Logger(__name__, self)
     self.events = EventGroup("connected", "disconnected")
예제 #4
0
 def __init__(self, alias="default"):
     self.alias = alias
     self.listeners = defaultdict(list)
     self.autoReconnect = False
     self.connection = None
     self.connectionFileno = None
     self.notifications = set()
     self.notifier = task.LoopingCall(self.handleNotifies)
     self.notifierDone = None
     self.connecting = None
     self.disconnecting = None
     self.registeredChannels = set()
     self.channelRegistrar = task.LoopingCall(
         lambda: ensureDeferred(self.registerChannels()))
     self.channelRegistrarDone = None
     self.log = Logger(__name__, self)
     self.events = EventGroup("connected", "disconnected")
     # the connection object isn't threadsafe, so we need to lock in order
     # to use it in different threads
     self._db_lock = threading.RLock()