예제 #1
0
    def run(self):
        m = None
        for t in t_enum():
            if t.name == 'MainThread':
                m = t
                break

        while m and m.isAlive() and self.alive:
            self.loop()
예제 #2
0
 def __init__(self):
     super(DrillingWell, self).__init__(name="DrillingWell")
     self.context = Context()
     self.push = self.context.socket(PUSH)
     self.push.bind("tcp://*:7000")
     self._shutdown = False
     for th in t_enum():
         if th.name == "MainThread":
             self.mainthread = th
예제 #3
0
 def __init__(self):
     super(DrillingWell, self).__init__(name="DrillingWell")
     self.context = Context()
     self.push = self.context.socket(PUSH)
     self.push.bind("tcp://*:7000")
     self._shutdown = False
     for th in t_enum():
         if th.name == "MainThread":
             self.mainthread = th
예제 #4
0
 def __init__(self):
     super(HomeBase, self).__init__(name="HomeBase")
     self.context = Context()
     self.pull = self.context.socket(PULL)
     self.pull.bind("tcp://*:7001")
     self._shutdown = False
     self.poller = Poller()
     self.poller.register(self.pull, POLLIN)
     for th in t_enum():
         if th.name == "MainThread":
             self.mainthread = th
예제 #5
0
 def __init__(self):
     super(HomeBase, self).__init__(name="HomeBase")
     self.context = Context()
     self.pull = self.context.socket(PULL)
     self.pull.bind("tcp://*:7001")
     self._shutdown = False
     self.poller = Poller()
     self.poller.register(self.pull, POLLIN)
     for th in t_enum():
         if th.name == "MainThread":
             self.mainthread = th
예제 #6
0
 def __init__(self):
     super(Leatherneck, self).__init__(name="Leatherneck")
     self.context = Context()
     self.pull = self.context.socket(PULL)
     self.pull.connect("tcp://localhost:7000")
     self.push = self.context.socket(PUSH)
     self.push.connect("tcp://localhost:7001")
     self.poller = Poller()
     self.poller.register(self.pull, POLLIN)
     self._shutdown = False
     for th in t_enum():
         if th.name == "MainThread":
             self.mainthread = th
예제 #7
0
 def __init__(self):
     super(Leatherneck, self).__init__(name="Leatherneck")
     self.context = Context()
     self.pull = self.context.socket(PULL)
     self.pull.connect("tcp://localhost:7000")
     self.push = self.context.socket(PUSH)
     self.push.connect("tcp://localhost:7001")
     self.poller = Poller()
     self.poller.register(self.pull, POLLIN)
     self._shutdown = False
     for th in t_enum():
         if th.name == "MainThread":
             self.mainthread = th
예제 #8
0
        self.socket.bind(('', 4433))
        self.poller.register(self.main_sock)
        self.socket.listen(4)

        t.__init__(self, globs)

    def loop(self):
        for fileno, event in self.poller.poll(1):
            if self.main_sock == fileno:
                ns, na = self.socket.accept()
                print('{} has connected on fileno {}'.format(na, ns.fileno()))
                ns_fileno = ns.fileno()

                self.sockets[ns_fileno] = {
                    'socket':
                    ns,
                    'fileno':
                    ns_fileno,
                    'address':
                    na,
                    't':
                    client(self.globs, self.poller, self.sockets, ns,
                           ns_fileno, na)
                }
                self.poller.register(ns_fileno, EPOLLIN)
        self.sleep()


x = listener(core)
while run and len(t_enum()) >= 1:
    sleep(core['threading']['t_offload'])