Exemple #1
0
    def doStop(self, cv=None):
        """
        Stops imap service (fetcher, factory and port).

        :param cv: A condition variable to which we can signal when imap
                   indeed stops.
        :type cv: threading.Condition
        :return: a Deferred that stops and flushes the in memory store data to
                 disk in another thread.
        :rtype: Deferred
        """
        if DO_PROFILE:
            log.msg("Stopping PROFILING")
            pr.disable()
            pr.dump_stats(PROFILE_DAT)

        ServerFactory.doStop(self)

        if cv is not None:
            def _stop_imap_cb():
                logger.debug('Stopping in memory store.')
                self._memstore.stop_and_flush()
                while not self._memstore.producer.is_queue_empty():
                    logger.debug('Waiting for queue to be empty.')
                    # TODO use a gatherResults over the new/dirty
                    # deferred list,
                    # as in memorystore's expunge() method.
                    time.sleep(1)
                # notify that service has stopped
                logger.debug('Notifying that service has stopped.')
                cv.acquire()
                cv.notify()
                cv.release()

            return threads.deferToThread(_stop_imap_cb)
Exemple #2
0
    def doStop(self):
        """
        Stops imap service (fetcher, factory and port).
        """
        # mark account as unusable, so any imap command will fail
        # with unauth state.
        self.theAccount.end_session()

        # TODO should wait for all the pending deferreds,
        # the twisted way!
        if DO_PROFILE:
            log.msg("Stopping PROFILING")
            pr.disable()
            pr.dump_stats(PROFILE_DAT)

        return ServerFactory.doStop(self)
Exemple #3
0
    def doStop(self):
        """
        Stops imap service (fetcher, factory and port).
        """
        # mark account as unusable, so any imap command will fail
        # with unauth state.
        self.theAccount.end_session()

        # TODO should wait for all the pending deferreds,
        # the twisted way!
        if DO_PROFILE:
            log.msg("Stopping PROFILING")
            pr.disable()
            pr.dump_stats(PROFILE_DAT)

        return ServerFactory.doStop(self)
Exemple #4
0
 def doStop(self):
     return ServerFactory.doStop(self)
Exemple #5
0
 def doStop(self):
     """
     Stops imap service (fetcher, factory and port).
     """
     return ServerFactory.doStop(self)
Exemple #6
0
	def doStop(self):
		debug( "Stopping factory." )
		ServerFactory.doStop(self)
Exemple #7
0
 def doStop(self):
     self.wrappedFactory.doStop()
     ServerFactory.doStop(self)
Exemple #8
0
 def doStop(self):
     """
     Stops imap service (fetcher, factory and port).
     """
     return ServerFactory.doStop(self)
 def doStop(self):
     self.wrappedFactory.doStop()
     ServerFactory.doStop(self)