replace unneeded ev_/EV_ references
parent
75e0c442f7
commit
11b4bdd8c5
|
@ -78,7 +78,7 @@ struct liBackendConfig {
|
|||
/* max requests per connection. -1: unlimited */
|
||||
int max_requests;
|
||||
|
||||
/* if enabled, the backend.watcher will be set to internal callback and EV_READ while the connection
|
||||
/* if enabled, the backend.watcher will be set to internal callback and LI_EV_READ while the connection
|
||||
* is not used by a vrequest;
|
||||
* if it sees input data it will log an error and close it, and if it sees eof it will
|
||||
* close it too
|
||||
|
|
|
@ -62,12 +62,12 @@ struct liConnection {
|
|||
liVRequest *mainvr;
|
||||
liHttpRequestCtx req_parser_ctx;
|
||||
|
||||
ev_tstamp ts_started; /* when connection was started, not a (v)request */
|
||||
li_tstamp ts_started; /* when connection was started, not a (v)request */
|
||||
|
||||
/* Keep alive timeout data */
|
||||
struct {
|
||||
GList *link;
|
||||
ev_tstamp timeout;
|
||||
li_tstamp timeout;
|
||||
guint max_idle;
|
||||
liEventTimer watcher;
|
||||
} keep_alive_data;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* Log targets specify where the log messages are written to. They are kept open for a certain amount of time (default 30s).
|
||||
* file://
|
||||
*
|
||||
* Logs are sent once per ev_loop() iteration to the logging thread in order to reduce syscalls and lock contention.
|
||||
* Logs are sent once per event loop iteration to the logging thread in order to reduce syscalls and lock contention.
|
||||
*/
|
||||
|
||||
/* #include <lighttpd/valgrind/valgrind.h> */
|
||||
|
@ -111,7 +111,7 @@ struct liLogServerData {
|
|||
|
||||
/* timestamp format cache */
|
||||
struct {
|
||||
ev_tstamp last_ts;
|
||||
li_tstamp last_ts;
|
||||
GString *format;
|
||||
GString *cached;
|
||||
} timestamp;
|
||||
|
|
|
@ -22,26 +22,6 @@ LI_API int li_send_fd(int s, int fd); /* write fd to unix socket s */
|
|||
LI_API int li_receive_fd(int s, int *fd); /* read fd from unix socket s */
|
||||
#endif
|
||||
|
||||
LI_API void li_ev_io_add_events(struct ev_loop *loop, ev_io *watcher, int events);
|
||||
LI_API void li_ev_io_rem_events(struct ev_loop *loop, ev_io *watcher, int events);
|
||||
LI_API void li_ev_io_set_events(struct ev_loop *loop, ev_io *watcher, int events);
|
||||
|
||||
#define li_ev_safe_ref_and_stop(stopf, loop, watcher) do { \
|
||||
ev_watcher *__w = (ev_watcher*) watcher; \
|
||||
if (ev_is_active(__w)) { \
|
||||
ev_ref(loop); \
|
||||
stopf(loop, watcher); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define li_ev_safe_unref_and_start(startf, loop, watcher) do { \
|
||||
ev_watcher *__w = (ev_watcher*) watcher; \
|
||||
if (!ev_is_active(__w)) { \
|
||||
startf(loop, watcher); \
|
||||
ev_unref(loop); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* URL inplace decode: replace %XX with character \xXX; replace control characters with '_' (< 32 || == 127) */
|
||||
LI_API void li_url_decode(GString *path);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ struct liConInfo {
|
|||
struct {
|
||||
guint64 bytes_in; /* total number of bytes received */
|
||||
guint64 bytes_out; /* total number of bytes sent */
|
||||
ev_tstamp last_avg;
|
||||
li_tstamp last_avg;
|
||||
guint64 bytes_in_5s; /* total number of bytes received at last 5s interval */
|
||||
guint64 bytes_out_5s; /* total number of bytes sent at last 5s interval */
|
||||
guint64 bytes_in_5s_diff; /* diff between bytes received at 5s interval n and interval n-1 */
|
||||
|
@ -81,7 +81,7 @@ struct liVRequest {
|
|||
|
||||
liVRequestState state;
|
||||
|
||||
ev_tstamp ts_started;
|
||||
li_tstamp ts_started;
|
||||
|
||||
GPtrArray *plugin_ctx;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ struct liWaitQueue {
|
|||
* li_waitqueue_push, li_waitqueue_pop and li_waitqueue_remove have O(1) complexity
|
||||
*/
|
||||
|
||||
/* initializes a waitqueue by creating the ev_timer and initializing the queue. precision is sub-seconds */
|
||||
/* initializes a waitqueue by creating the timer and initializing the queue. precision is sub-seconds */
|
||||
LI_API void li_waitqueue_init(liWaitQueue *queue, liEventLoop *loop, liWaitQueueCB callback, gdouble delay, gpointer data);
|
||||
|
||||
/* stops the waitqueue. to restart it, simply call li_waitqueue_update */
|
||||
|
|
|
@ -60,7 +60,6 @@ struct liWorker {
|
|||
|
||||
liEventLoop loop;
|
||||
liEventPrepare loop_prepare;
|
||||
/* ev_check loop_check; */
|
||||
liEventAsync worker_stop_watcher, worker_stopping_watcher, worker_suspend_watcher, worker_exit_watcher;
|
||||
|
||||
liLogWorkerData logs;
|
||||
|
@ -70,7 +69,7 @@ struct liWorker {
|
|||
*/
|
||||
guint connections_active_max_5min; /** max() of active connections during the last 5 minutes */
|
||||
GArray *connections; /** array of (connection*), use only from local worker context */
|
||||
ev_tstamp connections_gc_ts;
|
||||
li_tstamp connections_gc_ts;
|
||||
|
||||
GString *tmp_str; /**< can be used everywhere for local temporary needed strings */
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <lighttpd/utils.h>
|
||||
|
||||
/* IMPORTANT
|
||||
* In order to keep _release thread-safe the ev_io watcher keeps a
|
||||
* In order to keep _release thread-safe the io watcher keeps a
|
||||
* reference too while active; when the last reference is dropped
|
||||
* we don't have to stop the watcher, and everything else is
|
||||
* "thread-safe" if no one is using it anymore (refcount == 0)
|
||||
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* Most "public" functions have to be called while they hold
|
||||
* a reference somehow; the other way this code gets executed is
|
||||
* through the ev_io callback, which is why we get an extra
|
||||
* through the io callback, which is why we get an extra
|
||||
* reference there, so our refcount doesn't drop to 0 while
|
||||
* we are working.
|
||||
*
|
||||
|
@ -135,14 +135,14 @@ static void send_queue_reset(GQueue *queue) {
|
|||
}
|
||||
|
||||
static void memcached_start_io(liMemcachedCon *con) {
|
||||
if (!((ev_watcher*) &con->con_watcher)->active) {
|
||||
if (!li_event_active(&con->con_watcher)) {
|
||||
li_memcached_con_acquire(con);
|
||||
li_event_start(&con->con_watcher);
|
||||
}
|
||||
}
|
||||
|
||||
static void memcached_stop_io(liMemcachedCon *con) {
|
||||
if (((ev_watcher*) &con->con_watcher)->active) {
|
||||
if (li_event_active(&con->con_watcher)) {
|
||||
li_event_stop(&con->con_watcher);
|
||||
li_memcached_con_release(con);
|
||||
}
|
||||
|
|
|
@ -233,28 +233,6 @@ gint li_receive_fd(gint s, gint *fd) { /* read fd from unix socket s */
|
|||
|
||||
|
||||
|
||||
void li_ev_io_add_events(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||
if ((watcher->events & events) == events) return;
|
||||
if (loop != NULL) ev_io_stop(loop, watcher);
|
||||
ev_io_set(watcher, watcher->fd, watcher->events | events);
|
||||
if (loop != NULL) ev_io_start(loop, watcher);
|
||||
}
|
||||
|
||||
void li_ev_io_rem_events(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||
if (0 == (watcher->events & events)) return;
|
||||
if (loop != NULL) ev_io_stop(loop, watcher);
|
||||
ev_io_set(watcher, watcher->fd, watcher->events & ~events);
|
||||
if (loop != NULL) ev_io_start(loop, watcher);
|
||||
}
|
||||
|
||||
void li_ev_io_set_events(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||
if (events == (watcher->events & (EV_READ | EV_WRITE))) return;
|
||||
if (loop != NULL) ev_io_stop(loop, watcher);
|
||||
ev_io_set(watcher, watcher->fd, (watcher->events & ~(EV_READ | EV_WRITE)) | events);
|
||||
if (loop != NULL) ev_io_start(loop, watcher);
|
||||
}
|
||||
|
||||
|
||||
/* converts hex char (0-9, A-Z, a-z) to decimal.
|
||||
* returns -1 on invalid input.
|
||||
*/
|
||||
|
|
|
@ -566,7 +566,7 @@ gboolean li_vrequest_redirect_directory(liVRequest *vr) {
|
|||
return li_vrequest_redirect(vr, uri);
|
||||
}
|
||||
|
||||
static void update_stats_avg(ev_tstamp now, liConInfo *coninfo) {
|
||||
static void update_stats_avg(li_tstamp now, liConInfo *coninfo) {
|
||||
if ((now - coninfo->stats.last_avg) >= 5.0) {
|
||||
coninfo->stats.bytes_out_5s_diff = coninfo->stats.bytes_out - coninfo->stats.bytes_out_5s;
|
||||
coninfo->stats.bytes_out_5s = coninfo->stats.bytes_out;
|
||||
|
|
|
@ -37,7 +37,7 @@ void li_worker_check_keepalive(liWorker *wrk) {
|
|||
|
||||
static void worker_keepalive_cb(liEventBase *watcher, int events) {
|
||||
liWorker *wrk = LI_CONTAINER_OF(li_event_timer_from(watcher), liWorker, keep_alive_timer);
|
||||
ev_tstamp now = li_cur_ts(wrk);
|
||||
li_tstamp now = li_cur_ts(wrk);
|
||||
GQueue *q = &wrk->keep_alive_queue;
|
||||
GList *l;
|
||||
liConnection *con;
|
||||
|
@ -46,7 +46,7 @@ static void worker_keepalive_cb(liEventBase *watcher, int events) {
|
|||
|
||||
while ( NULL != (l = g_queue_peek_head_link(q)) &&
|
||||
(con = (liConnection*) l->data)->keep_alive_data.timeout <= now ) {
|
||||
ev_tstamp remaining = con->keep_alive_data.max_idle - wrk->srv->keep_alive_queue_timeout - (now - con->keep_alive_data.timeout);
|
||||
li_tstamp remaining = con->keep_alive_data.max_idle - wrk->srv->keep_alive_queue_timeout - (now - con->keep_alive_data.timeout);
|
||||
if (remaining > 0) {
|
||||
g_queue_delete_link(q, l);
|
||||
con->keep_alive_data.link = NULL;
|
||||
|
@ -69,7 +69,7 @@ static void worker_io_timeout_cb(liWaitQueue *wq, gpointer data) {
|
|||
liWorker *wrk = data;
|
||||
liConnection *con;
|
||||
liWaitQueueElem *wqe;
|
||||
ev_tstamp now = li_cur_ts(wrk);
|
||||
li_tstamp now = li_cur_ts(wrk);
|
||||
|
||||
while ((wqe = li_waitqueue_pop(wq)) != NULL) {
|
||||
liVRequest *vr;
|
||||
|
@ -211,7 +211,7 @@ static void li_worker_new_con_cb(liEventBase *watcher, int events) {
|
|||
/* stats watcher */
|
||||
static void worker_stats_watcher_cb(liEventBase *watcher, int events) {
|
||||
liWorker *wrk = LI_CONTAINER_OF(li_event_timer_from(watcher), liWorker, stats_watcher);
|
||||
ev_tstamp now = li_cur_ts(wrk);
|
||||
li_tstamp now = li_cur_ts(wrk);
|
||||
UNUSED(events);
|
||||
|
||||
if (wrk->stats.last_update && now != wrk->stats.last_update) {
|
||||
|
@ -537,7 +537,7 @@ static liConnection* worker_con_get(liWorker *wrk) {
|
|||
|
||||
void li_worker_con_put(liConnection *con) {
|
||||
liWorker *wrk = con->wrk;
|
||||
ev_tstamp now = li_cur_ts(wrk);
|
||||
li_tstamp now = li_cur_ts(wrk);
|
||||
|
||||
if (-1 == (gint) con->idx)
|
||||
/* already inactive connection */
|
||||
|
|
|
@ -96,10 +96,10 @@ struct AuthFile {
|
|||
GMutex *lock;
|
||||
|
||||
AuthFileData *data;
|
||||
ev_tstamp last_stat;
|
||||
li_tstamp last_stat;
|
||||
|
||||
gint ttl;
|
||||
ev_tstamp next_check; /* unused */
|
||||
li_tstamp next_check; /* unused */
|
||||
};
|
||||
|
||||
static AuthFileData* auth_file_load(liServer *srv, AuthFile *f) {
|
||||
|
@ -181,7 +181,7 @@ static void auth_file_data_release(AuthFileData *data) {
|
|||
}
|
||||
|
||||
static AuthFileData* auth_file_get_data(liWorker *wrk, AuthFile *f) {
|
||||
ev_tstamp now = li_cur_ts(wrk);
|
||||
li_tstamp now = li_cur_ts(wrk);
|
||||
AuthFileData *data = NULL;
|
||||
|
||||
g_mutex_lock(f->lock);
|
||||
|
|
|
@ -62,7 +62,7 @@ struct mod_debug_data_t {
|
|||
liHttpMethod method;
|
||||
goffset request_size;
|
||||
goffset response_size;
|
||||
ev_tstamp ts_started;
|
||||
li_tstamp ts_started;
|
||||
guint64 bytes_in;
|
||||
guint64 bytes_out;
|
||||
guint64 bytes_in_5s_diff;
|
||||
|
@ -226,7 +226,7 @@ static void debug_collect_cb(gpointer cbdata, gpointer fdata, GPtrArray *result,
|
|||
GString *duration = g_string_sized_new(15);
|
||||
|
||||
g_string_append_printf(html, "<p>now: %f<br>io timeout watcher active/repeat: %s/%f<br></p>\n",
|
||||
li_cur_ts(vr->wrk), ev_is_active(&(vr->wrk->io_timeout_queue.timer)) ? "yes":"no",
|
||||
li_cur_ts(vr->wrk), li_event_active(&vr->wrk->io_timeout_queue.timer) ? "yes":"no",
|
||||
vr->wrk->io_timeout_queue.timer.libevmess.timer.repeat
|
||||
);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ struct memcached_ctx {
|
|||
liSocketAddress addr;
|
||||
liPattern *pattern;
|
||||
guint flags;
|
||||
ev_tstamp ttl;
|
||||
li_tstamp ttl;
|
||||
gssize maxsize;
|
||||
gboolean headers;
|
||||
|
||||
|
@ -780,7 +780,7 @@ static int lua_mc_set(lua_State *L) {
|
|||
size_t len;
|
||||
GError *err = NULL;
|
||||
liVRequest *vr;
|
||||
ev_tstamp ttl;
|
||||
li_tstamp ttl;
|
||||
liBuffer *valuebuf;
|
||||
|
||||
mc_lua_request *mreq;
|
||||
|
@ -855,7 +855,7 @@ static int lua_mc_setq(lua_State *L) {
|
|||
const char *str;
|
||||
size_t len;
|
||||
GError *err = NULL;
|
||||
ev_tstamp ttl;
|
||||
li_tstamp ttl;
|
||||
liBuffer *valuebuf;
|
||||
|
||||
liMemcachedRequest *req;
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct vhost_map_regex_entry vhost_map_regex_entry;
|
|||
struct vhost_map_regex_entry {
|
||||
GRegex *regex;
|
||||
liValue *action;
|
||||
ev_tstamp tstamp;
|
||||
li_tstamp tstamp;
|
||||
guint hits;
|
||||
guint hits_30s;
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ static liAction* vhost_map_create(liServer *srv, liWorker *wrk, liPlugin* p, liV
|
|||
|
||||
static liHandlerResult vhost_map_regex(liVRequest *vr, gpointer param, gpointer *context) {
|
||||
guint i;
|
||||
ev_tstamp now;
|
||||
li_tstamp now;
|
||||
vhost_map_regex_data *mrd = param;
|
||||
GArray *list = g_array_index(mrd->lists, GArray*, vr->wrk->ndx);
|
||||
gboolean debug = _OPTION(vr, mrd->plugin, 0).boolean;
|
||||
|
|
Loading…
Reference in New Issue