Work on removing libevent completely as a mandatory dependency.

This commit is contained in:
Jan Vidar Krey
2010-01-07 20:55:13 +01:00
parent f35b2c35cb
commit 6a4b9c58f4
13 changed files with 583 additions and 358 deletions

View File

@@ -71,6 +71,7 @@ void uman_print_stats(struct hub_info* hub)
}
#ifdef USERMANAGER_TIMER
#ifdef USE_LIBEVENT
static void timer_statistics(int fd, short ev, void *arg)
{
struct hub_info* hub = (struct hub_info*) arg;
@@ -80,13 +81,16 @@ static void timer_statistics(int fd, short ev, void *arg)
evtimer_add(&hub->ev_timer, &timeout);
}
#endif
#endif
int uman_init(struct hub_info* hub)
{
struct hub_user_manager* users = NULL;
#ifdef USERMANAGER_TIMER
#ifdef USE_LIBEVENT
struct timeval timeout = { TIMEOUT_STATS, 0 };
#endif
#endif
if (!hub)
return -1;
@@ -108,11 +112,13 @@ int uman_init(struct hub_info* hub)
hub->users = users;
#ifdef USERMANAGER_TIMER
#ifdef USE_LIBEVENT
if (net_get_evbase())
{
evtimer_set(&hub->ev_timer, timer_statistics, hub);
evtimer_add(&hub->ev_timer, &timeout);
}
#endif
#endif // 0
return 0;
}
@@ -124,8 +130,10 @@ int uman_shutdown(struct hub_info* hub)
return -1;
#ifdef USERMANAGER_TIMER
#ifdef USE_LIBEVENT
if (evtimer_pending(&hub->ev_timer, 0))
evtimer_del(&hub->ev_timer);
#endif
#endif
if (hub->users->list)