Beispiel #1
0
    def loop(self):
        """The dispatch loop."""

        start = time.time()
        while self.socket_map:
            nbsock = self.nbserver.netbeans
            # start the debugger
            if start is not False:
                if time.time() - start > CONNECTION_TIMEOUT:
                    raise IOError(CONNECTION_ERROR % str(CONNECTION_TIMEOUT))
                if nbsock and nbsock.ready:
                    start = False
                    info(nbsock)
                    nbsock.set_debugger(self.debugger)

                    # can daemonize now, no more critical startup errors to
                    # print on the console
                    if self.options.daemon:
                        daemonize()
                    version = __tag__
                    if __changeset__:
                        version += '.' + __changeset__
                    info('pyclewn version %s and the %s debugger',
                                        version, self.clazz.__name__)

            # instantiate a new debugger
            elif nbsock and self.debugger.closed and nbsock.connected:
                self.debugger = self.clazz(self.options)
                nbsock.set_debugger(self.debugger)
                info('new "%s" instance', self.clazz.__name__.lower())

            timeout = self.debugger._call_jobs()
            evtloop.poll(self.socket_map, timeout=timeout)

        self.debugger.close()
Beispiel #2
0
    def loop(self):
        """The dispatch loop."""

        start = time.time()
        nbsock = None
        while True:
            # start the debugger
            if start is not False:
                if time.time() - start > CONNECTION_TIMEOUT:
                    raise IOError(CONNECTION_ERROR % str(CONNECTION_TIMEOUT))
                nbsock = self.nbserver.netbeans
                if nbsock and nbsock.ready:
                    start = False
                    info(nbsock)
                    nbsock.set_debugger(self.debugger)

                    # can daemonize now, no more critical startup errors to
                    # print on the console
                    if self.options.daemon:
                        daemonize()
                    version = __tag__
                    if __changeset__:
                        version += '.' + __changeset__
                    info('pyclewn version %s and the %s debugger',
                                        version, self.clazz.__name__)
            elif nbsock.connected:
                # instantiate a new debugger
                if self.debugger.closed:
                    self.create_debugger()._read_keysfile()
                    nbsock.set_debugger(self.debugger)
                    info('new "%s" instance', self.clazz.__name__.lower())
            else:
                if not self.debugger.started or self.debugger.closed:
                    break

            timeout = self.debugger._call_jobs()
            self.poll.run(timeout=timeout)

        self.debugger.close()
Beispiel #3
0
    def loop(self):
        """The dispatch loop."""

        start = time.time()
        nbsock = None
        while True:
            # start the debugger
            if start is not False:
                if time.time() - start > CONNECTION_TIMEOUT:
                    raise IOError(CONNECTION_ERROR % str(CONNECTION_TIMEOUT))
                nbsock = self.nbserver.netbeans
                if nbsock and nbsock.ready:
                    start = False
                    info(nbsock)
                    nbsock.set_debugger(self.debugger)

                    # can daemonize now, no more critical startup errors to
                    # print on the console
                    if self.options.daemon:
                        daemonize()
                    version = __tag__
                    if __changeset__:
                        version += '.' + __changeset__
                    info('pyclewn version %s and the %s debugger', version,
                         self.clazz.__name__)
            elif nbsock.connected:
                # instantiate a new debugger
                if self.debugger.closed:
                    self.create_debugger()._read_keysfile()
                    nbsock.set_debugger(self.debugger)
                    info('new "%s" instance', self.clazz.__name__.lower())
            else:
                if not self.debugger.started or self.debugger.closed:
                    break

            timeout = self.debugger._call_jobs()
            self.poll.run(timeout=timeout)

        self.debugger.close()