コード例 #1
0
 def run(r=None):
     if w.total > 1000:
         reactor.stop()
         return
     w.total += 1
     df = launch_coroutine(wrap_task(reactor.callLater), w.do_some_things)
     df.addCallback(run)
     df.addErrback(set_event_error)
コード例 #2
0
 def run(r=None):
     if w.total > 1000:
         reactor.stop()
         return
     w.total += 1
     df = launch_coroutine(wrap_task(reactor.callLater),
                           w.do_some_things)
     df.addCallback(run)
     df.addErrback(set_event_error)
コード例 #3
0
ファイル: log.py プロジェクト: amitgardharia/BitTorrent-5.0.9
 def test_rate_limited_logger():
     injectLogger(verbose = True)
     log = RateLimitedLogger(logging.getLogger("myapp"), 1,1)
     log.info( "should be printed." )
     log.info( "should not be printed" )  # but should log "discard" message.
     log.info( "also should not be printed" )  # should not logging of discard message.
     df = Deferred()
     reactor.callLater(3, df.callback, True)
     like_yield(df)
     log.info( "should also be printed" )
     reactor.stop()
コード例 #4
0
 def test_rate_limited_logger():
     injectLogger(verbose = True)
     log = RateLimitedLogger(logging.getLogger("myapp"), 1,1)
     log.info( "should be printed." )
     log.info( "should not be printed" )  # but should log "discard" message.
     log.info( "also should not be printed" )  # should not logging of discard message.
     df = Deferred()
     reactor.callLater(3, df.callback, True)
     like_yield(df)
     log.info( "should also be printed" )
     reactor.stop()
コード例 #5
0
    def _stop(self, r=None):
        assert thread.get_ident() == self.ident

        connections = list(self.single_sockets)
        for connection in connections:
            try:
                connection.close()
            except:
                pass

        reactor.suggestThreadPoolSize(0)
        try:
            reactor.stop()
        except RuntimeError:
            # exceptions.RuntimeError: can't stop reactor that isn't running
            pass
コード例 #6
0
ファイル: RawServer_twisted.py プロジェクト: hitzjd/DHT
    def _stop(self, r=None):
        assert thread.get_ident() == self.ident

        connections = list(self.single_sockets)
        for connection in connections:
            try:
                connection.close()
            except:
                pass

        reactor.suggestThreadPoolSize(0)
        try:
            reactor.stop()
        except RuntimeError:
            # exceptions.RuntimeError: can't stop reactor that isn't running
            pass
コード例 #7
0
 def foo():
     reactor.stop()
     zuul = dana
コード例 #8
0
 def set_event_error(x):
     print "A critical error occured:", str(x[0]), ":", str(x[1])
     reactor.stop()
コード例 #9
0
 def set_event(x):
     w.total -= 1
     assert w.total >= 0
     if w.total == 0:
         reactor.stop()
コード例 #10
0
 def set_event(x):
     w.total -= 1
     assert w.total >= 0
     if w.total == 0:
         reactor.stop()
コード例 #11
0
 def set_event_error(x):
     print "A critical error occured:", str(x[0]), ":", str(x[1])
     reactor.stop()
コード例 #12
0
ファイル: log.py プロジェクト: amitgardharia/BitTorrent-5.0.9
 def foo():
     reactor.stop()
     zuul = dana