diff --git a/btpd/btpd.c b/btpd/btpd.c index 109c7b6..d3ee071 100644 --- a/btpd/btpd.c +++ b/btpd/btpd.c @@ -130,6 +130,6 @@ btpd_init(void) tr_init(); tlib_init(); - timer_init(&m_heartbeat, heartbeat_cb, NULL); + evtimer_init(&m_heartbeat, heartbeat_cb, NULL); btpd_timer_add(&m_heartbeat, (& (struct timespec) { 1, 0 })); } diff --git a/btpd/content.c b/btpd/content.c index 72bf4e5..5394508 100644 --- a/btpd/content.c +++ b/btpd/content.c @@ -539,5 +539,5 @@ cm_start(struct torrent *tp, int force_test) void cm_init(void) { - timer_init(&m_workev, worker_cb, NULL); + evtimer_init(&m_workev, worker_cb, NULL); } diff --git a/btpd/http_tr_if.c b/btpd/http_tr_if.c index beb29c0..f7fd551 100644 --- a/btpd/http_tr_if.c +++ b/btpd/http_tr_if.c @@ -239,7 +239,7 @@ httptr_req(struct torrent *tp, struct tr_tier *tr, const char *aurl, http_url = http_url_get(treq->req); treq->nc = btpd_name_connect(http_url->host, http_url->port, httptr_nc_cb, treq); - timer_init(&treq->timer, httptr_io_cb, treq); + evtimer_init(&treq->timer, httptr_io_cb, treq); btpd_timer_add(&treq->timer, (& (struct timespec) { 60, 0 })); return treq; } diff --git a/btpd/tracker_req.c b/btpd/tracker_req.c index 32c56e9..a792e7f 100644 --- a/btpd/tracker_req.c +++ b/btpd/tracker_req.c @@ -163,7 +163,7 @@ tier_create(struct torrent *tp, struct mi_tier *tier) t->tp = tp; t->interval = -1; t->event = TR_EV_STOPPED; - timer_init(&t->timer, tier_timer_cb, t); + evtimer_init(&t->timer, tier_timer_cb, t); return t; } else { free(t); diff --git a/btpd/upload.c b/btpd/upload.c index 1fb28ca..8e6a0dc 100644 --- a/btpd/upload.c +++ b/btpd/upload.c @@ -190,6 +190,6 @@ ul_init(void) m_max_uploads = 5 + (net_bw_limit_out / (100 << 10)); } - timer_init(&m_choke_timer, choke_cb, NULL); + evtimer_init(&m_choke_timer, choke_cb, NULL); btpd_timer_add(&m_choke_timer, CHOKE_INTERVAL); } diff --git a/btpd/util.c b/btpd/util.c index 02ce032..700b0e6 100644 --- a/btpd/util.c +++ b/btpd/util.c @@ -52,14 +52,14 @@ btpd_ev_disable(struct fdev *ev, uint16_t flags) void btpd_timer_add(struct timeout *to, struct timespec *ts) { - if (timer_add(to, ts) != 0) + if (evtimer_add(to, ts) != 0) btpd_err("Failed to add timeout (%s).\n", strerror(errno)); } void btpd_timer_del(struct timeout *to) { - timer_del(to); + evtimer_del(to); } static const char * diff --git a/evloop/epoll.c b/evloop/epoll.c index 5152194..824d142 100644 --- a/evloop/epoll.c +++ b/evloop/epoll.c @@ -84,8 +84,8 @@ evloop(void) int nev, i, millisecs; struct timespec delay; while (1) { - timers_run(); - delay = timer_delay(); + evtimers_run(); + delay = evtimer_delay(); if (delay.tv_sec >= 0) millisecs = delay.tv_sec * 1000 + delay.tv_nsec / 1000000; else diff --git a/evloop/evloop.h b/evloop/evloop.h index 97f7665..55589aa 100644 --- a/evloop/evloop.h +++ b/evloop/evloop.h @@ -47,11 +47,11 @@ int fdev_del(struct fdev *ev); int fdev_enable(struct fdev *ev, uint16_t flags); int fdev_disable(struct fdev *ev, uint16_t flags); -void timer_init(struct timeout *, evloop_cb_t, void *); -int timer_add(struct timeout *, struct timespec *); -void timer_del(struct timeout *); +void evtimer_init(struct timeout *, evloop_cb_t, void *); +int evtimer_add(struct timeout *, struct timespec *); +void evtimer_del(struct timeout *); -void timers_run(void); -struct timespec timer_delay(void); +void evtimers_run(void); +struct timespec evtimer_delay(void); #endif diff --git a/evloop/kqueue.c b/evloop/kqueue.c index 7f323db..649e838 100644 --- a/evloop/kqueue.c +++ b/evloop/kqueue.c @@ -89,8 +89,8 @@ evloop(void) int nev, i; struct timespec delay; while (1) { - timers_run(); - delay = timer_delay(); + evtimers_run(); + delay = evtimer_delay(); if ((nev = kevent(m_kq, NULL, 0, m_evs, 100, &delay)) < 0) { if (errno == EINTR) diff --git a/evloop/poll.c b/evloop/poll.c index 0996374..157cfa1 100644 --- a/evloop/poll.c +++ b/evloop/poll.c @@ -107,9 +107,9 @@ evloop(void) int millisecs; struct timespec delay; while (1) { - timers_run(); + evtimers_run(); - delay = timer_delay(); + delay = evtimer_delay(); if (delay.tv_sec >= 0) millisecs = delay.tv_sec * 1000 + delay.tv_nsec / 1000000; else diff --git a/evloop/timer.c b/evloop/timer.c index 3ef3091..3174c08 100644 --- a/evloop/timer.c +++ b/evloop/timer.c @@ -38,7 +38,7 @@ subtime(struct timespec a, struct timespec b) } void -timer_init(struct timeout *h, evloop_cb_t cb, void *arg) +evtimer_init(struct timeout *h, evloop_cb_t cb, void *arg) { h->cb = cb; h->arg = arg; @@ -47,7 +47,7 @@ timer_init(struct timeout *h, evloop_cb_t cb, void *arg) } int -timer_add(struct timeout *h, struct timespec *t) +evtimer_add(struct timeout *h, struct timespec *t) { struct timespec now, sum; clock_gettime(TIMER_CLOCK, &now); @@ -61,7 +61,7 @@ timer_add(struct timeout *h, struct timespec *t) } void -timer_del(struct timeout *h) +evtimer_del(struct timeout *h) { if (h->th.i >= 0) { timeheap_remove(&h->th); @@ -70,7 +70,7 @@ timer_del(struct timeout *h) } void -timers_run(void) +evtimers_run(void) { struct timespec now; clock_gettime(TIMER_CLOCK, &now); @@ -86,7 +86,7 @@ timers_run(void) } struct timespec -timer_delay(void) +evtimer_delay(void) { struct timespec now, diff; if (timeheap_size() == 0) {