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

@@ -21,7 +21,9 @@
static int is_ipv6_supported = -1; /* -1 = CHECK, 0 = NO, 1 = YES */
static int net_initialized = 0;
#ifdef USE_LIBEVENT
static struct event_base* net_evbase = 0;
#endif
static struct net_statistics stats;
static struct net_statistics stats_total;
@@ -47,6 +49,7 @@ int net_initialize()
}
#endif /* WINSOCK */
#ifdef USE_LIBEVENT
net_evbase = event_init();
if (!net_evbase)
{
@@ -54,6 +57,7 @@ int net_initialize()
return 0;
}
LOG_DEBUG("Using libevent %s, backend: %s", event_get_version(), event_get_method());
#endif
net_stats_initialize();
@@ -98,8 +102,10 @@ int net_destroy()
{
LOG_TRACE("Shutting down network monitor");
#ifdef USE_LIBEVENT
event_base_free(net_evbase);
net_evbase = 0;
#endif
#ifdef SSL_SUPPORT
/* FIXME: Shutdown OpenSSL here. */
@@ -114,10 +120,12 @@ int net_destroy()
return -1;
}
#ifdef USE_LIBEVENT
struct event_base* net_get_evbase()
{
return net_evbase;
}
#endif
static void net_error_out(int fd, const char* func)
{