@@ -130,6 +130,6 @@ btpd_init(void) | |||||
tr_init(); | tr_init(); | ||||
tlib_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 })); | btpd_timer_add(&m_heartbeat, (& (struct timespec) { 1, 0 })); | ||||
} | } |
@@ -539,5 +539,5 @@ cm_start(struct torrent *tp, int force_test) | |||||
void | void | ||||
cm_init(void) | cm_init(void) | ||||
{ | { | ||||
timer_init(&m_workev, worker_cb, NULL); | evtimer_init(&m_workev, worker_cb, NULL); | ||||
} | } |
@@ -239,7 +239,7 @@ httptr_req(struct torrent *tp, struct tr_tier *tr, const char *aurl, | |||||
http_url = http_url_get(treq->req); | http_url = http_url_get(treq->req); | ||||
treq->nc = btpd_name_connect(http_url->host, http_url->port, | treq->nc = btpd_name_connect(http_url->host, http_url->port, | ||||
httptr_nc_cb, treq); | 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 })); | btpd_timer_add(&treq->timer, (& (struct timespec) { 60, 0 })); | ||||
return treq; | return treq; | ||||
} | } | ||||
@@ -163,7 +163,7 @@ tier_create(struct torrent *tp, struct mi_tier *tier) | |||||
t->tp = tp; | t->tp = tp; | ||||
t->interval = -1; | t->interval = -1; | ||||
t->event = TR_EV_STOPPED; | t->event = TR_EV_STOPPED; | ||||
timer_init(&t->timer, tier_timer_cb, t); | evtimer_init(&t->timer, tier_timer_cb, t); | ||||
return t; | return t; | ||||
} else { | } else { | ||||
free(t); | free(t); | ||||
@@ -190,6 +190,6 @@ ul_init(void) | |||||
m_max_uploads = 5 + (net_bw_limit_out / (100 << 10)); | 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); | btpd_timer_add(&m_choke_timer, CHOKE_INTERVAL); | ||||
} | } |
@@ -52,14 +52,14 @@ btpd_ev_disable(struct fdev *ev, uint16_t flags) | |||||
void | void | ||||
btpd_timer_add(struct timeout *to, struct timespec *ts) | 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)); | btpd_err("Failed to add timeout (%s).\n", strerror(errno)); | ||||
} | } | ||||
void | void | ||||
btpd_timer_del(struct timeout *to) | btpd_timer_del(struct timeout *to) | ||||
{ | { | ||||
timer_del(to); | evtimer_del(to); | ||||
} | } | ||||
static const char * | static const char * | ||||
@@ -84,8 +84,8 @@ evloop(void) | |||||
int nev, i, millisecs; | int nev, i, millisecs; | ||||
struct timespec delay; | struct timespec delay; | ||||
while (1) { | while (1) { | ||||
timers_run(); | evtimers_run(); | ||||
delay = timer_delay(); | delay = evtimer_delay(); | ||||
if (delay.tv_sec >= 0) | if (delay.tv_sec >= 0) | ||||
millisecs = delay.tv_sec * 1000 + delay.tv_nsec / 1000000; | millisecs = delay.tv_sec * 1000 + delay.tv_nsec / 1000000; | ||||
else | else | ||||
@@ -47,11 +47,11 @@ int fdev_del(struct fdev *ev); | |||||
int fdev_enable(struct fdev *ev, uint16_t flags); | int fdev_enable(struct fdev *ev, uint16_t flags); | ||||
int fdev_disable(struct fdev *ev, uint16_t flags); | int fdev_disable(struct fdev *ev, uint16_t flags); | ||||
void timer_init(struct timeout *, evloop_cb_t, void *); | void evtimer_init(struct timeout *, evloop_cb_t, void *); | ||||
int timer_add(struct timeout *, struct timespec *); | int evtimer_add(struct timeout *, struct timespec *); | ||||
void timer_del(struct timeout *); | void evtimer_del(struct timeout *); | ||||
void timers_run(void); | void evtimers_run(void); | ||||
struct timespec timer_delay(void); | struct timespec evtimer_delay(void); | ||||
#endif | #endif |
@@ -89,8 +89,8 @@ evloop(void) | |||||
int nev, i; | int nev, i; | ||||
struct timespec delay; | struct timespec delay; | ||||
while (1) { | while (1) { | ||||
timers_run(); | evtimers_run(); | ||||
delay = timer_delay(); | delay = evtimer_delay(); | ||||
if ((nev = kevent(m_kq, NULL, 0, m_evs, 100, &delay)) < 0) { | if ((nev = kevent(m_kq, NULL, 0, m_evs, 100, &delay)) < 0) { | ||||
if (errno == EINTR) | if (errno == EINTR) | ||||
@@ -107,9 +107,9 @@ evloop(void) | |||||
int millisecs; | int millisecs; | ||||
struct timespec delay; | struct timespec delay; | ||||
while (1) { | while (1) { | ||||
timers_run(); | evtimers_run(); | ||||
delay = timer_delay(); | delay = evtimer_delay(); | ||||
if (delay.tv_sec >= 0) | if (delay.tv_sec >= 0) | ||||
millisecs = delay.tv_sec * 1000 + delay.tv_nsec / 1000000; | millisecs = delay.tv_sec * 1000 + delay.tv_nsec / 1000000; | ||||
else | else | ||||
@@ -38,7 +38,7 @@ subtime(struct timespec a, struct timespec b) | |||||
} | } | ||||
void | 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->cb = cb; | ||||
h->arg = arg; | h->arg = arg; | ||||
@@ -47,7 +47,7 @@ timer_init(struct timeout *h, evloop_cb_t cb, void *arg) | |||||
} | } | ||||
int | int | ||||
timer_add(struct timeout *h, struct timespec *t) | evtimer_add(struct timeout *h, struct timespec *t) | ||||
{ | { | ||||
struct timespec now, sum; | struct timespec now, sum; | ||||
clock_gettime(TIMER_CLOCK, &now); | clock_gettime(TIMER_CLOCK, &now); | ||||
@@ -61,7 +61,7 @@ timer_add(struct timeout *h, struct timespec *t) | |||||
} | } | ||||
void | void | ||||
timer_del(struct timeout *h) | evtimer_del(struct timeout *h) | ||||
{ | { | ||||
if (h->th.i >= 0) { | if (h->th.i >= 0) { | ||||
timeheap_remove(&h->th); | timeheap_remove(&h->th); | ||||
@@ -70,7 +70,7 @@ timer_del(struct timeout *h) | |||||
} | } | ||||
void | void | ||||
timers_run(void) | evtimers_run(void) | ||||
{ | { | ||||
struct timespec now; | struct timespec now; | ||||
clock_gettime(TIMER_CLOCK, &now); | clock_gettime(TIMER_CLOCK, &now); | ||||
@@ -86,7 +86,7 @@ timers_run(void) | |||||
} | } | ||||
struct timespec | struct timespec | ||||
timer_delay(void) | evtimer_delay(void) | ||||
{ | { | ||||
struct timespec now, diff; | struct timespec now, diff; | ||||
if (timeheap_size() == 0) { | if (timeheap_size() == 0) { | ||||