Beispiel #1
0
def meter(dispatcher, when):
    "decorate a server dispatcher with stream meters"
    async_limits.meter_recv(dispatcher, when)
    async_limits.meter_send(dispatcher, when)

    def close():
        del (dispatcher.recv, dispatcher.send, dispatcher.close)
        dispatcher.close()
        dispatcher.async_server.server_close(dispatcher)

    dispatcher.close = close
def meter (dispatcher, when):
        "decorate a server dispatcher with stream meters"
        async_limits.meter_recv (dispatcher, when)
        async_limits.meter_send (dispatcher, when)
        def close ():
                del (
                        dispatcher.recv, 
                        dispatcher.send, 
                        dispatcher.close
                        )
                dispatcher.close ()
                dispatcher.async_server.server_close (dispatcher)
                
        dispatcher.close = close
Beispiel #3
0
    def throttle(dispatcher, when):
        "decorate a client dispatcher with stream limits"
        async_limits.meter_recv(dispatcher, when)
        async_limits.meter_send(dispatcher, when)
        dispatcher.limit_inactive = timeout
        async_limits.throttle_readable(dispatcher, when,
                                       listen.ac_in_throttle_Bps)
        async_limits.throttle_writable(dispatcher, when,
                                       listen.ac_out_throttle_Bps)

        def close():
            del (dispatcher.recv, dispatcher.send, dispatcher.readable,
                 dispatcher.writable, dispatcher.close)
            dispatcher.close()
            dispatcher.async_server.server_close(dispatcher)

        dispatcher.close = close
 def throttle (dispatcher, when):
         "decorate a client dispatcher with stream limits"
         async_limits.meter_recv (dispatcher, when)
         async_limits.meter_send (dispatcher, when)
         dispatcher.limit_inactive = timeout
         async_limits.throttle_readable (
                 dispatcher, when, listen.ac_in_throttle_Bps
                 )
         async_limits.throttle_writable (
                 dispatcher, when, listen.ac_out_throttle_Bps
                 )
         def close ():
                 del (
                         dispatcher.recv, 
                         dispatcher.send, 
                         dispatcher.readable,
                         dispatcher.writable,
                         dispatcher.close
                         )
                 dispatcher.close ()
                 dispatcher.async_server.server_close (dispatcher)
                 
         dispatcher.close = close