2009-04-16 15:02:53 +00:00
|
|
|
#ifndef _LIGHTTPD_THROTTLE_H_
|
|
|
|
#define _LIGHTTPD_THROTTLE_H_
|
|
|
|
|
|
|
|
#define THROTTLE_GRANULARITY 0.2 /* defines how frequently a magazine is refilled. should be 0.1 <= x <= 1.0 */
|
|
|
|
|
2009-07-08 19:06:07 +00:00
|
|
|
typedef struct liThrottlePool liThrottlePool;
|
|
|
|
struct liThrottlePool {
|
2009-04-16 15:02:53 +00:00
|
|
|
GString *name;
|
|
|
|
guint rate; /** bytes/s */
|
|
|
|
gint magazine;
|
|
|
|
GQueue** queues; /** worker specific queues. each worker has 2 */
|
|
|
|
guint* current_queue;
|
2009-04-17 20:39:16 +00:00
|
|
|
gint num_cons;
|
2009-04-16 15:02:53 +00:00
|
|
|
|
|
|
|
gint rearming;
|
|
|
|
ev_tstamp last_pool_rearm;
|
|
|
|
ev_tstamp *last_con_rearm;
|
|
|
|
};
|
|
|
|
|
2009-10-09 13:38:12 +00:00
|
|
|
LI_API void li_throttle_cb(struct ev_loop *loop, ev_timer *w, int revents);
|
2009-04-16 15:02:53 +00:00
|
|
|
|
2009-10-09 13:38:12 +00:00
|
|
|
LI_API liThrottlePool *li_throttle_pool_new(liServer *srv, GString *name, guint rate);
|
|
|
|
LI_API void li_throttle_pool_free(liServer *srv, liThrottlePool *pool);
|
2009-04-16 15:02:53 +00:00
|
|
|
|
|
|
|
#endif
|