From: Tobias Brunner Date: Thu, 22 Dec 2011 09:47:44 +0000 (+0100) Subject: Removed remaining parts of controller_t.listen() implementation. X-Git-Tag: 5.0.0~329 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aac20ec784d6b2cd5b299d16502e365c396d364f;p=thirdparty%2Fstrongswan.git Removed remaining parts of controller_t.listen() implementation. --- diff --git a/src/libcharon/bus/bus.c b/src/libcharon/bus/bus.c index cfd7e1039d..e6ec8c49e5 100644 --- a/src/libcharon/bus/bus.c +++ b/src/libcharon/bus/bus.c @@ -1,4 +1,5 @@ /* + * Copyright (C) 2011 Tobias Brunner * Copyright (C) 2006 Martin Willi * Hochschule fuer Technik Rapperswil * @@ -19,7 +20,6 @@ #include #include -#include #include typedef struct private_bus_t private_bus_t; @@ -61,34 +61,22 @@ struct entry_t { */ listener_t *listener; - /** - * is this a active listen() call with a blocking thread - */ - bool blocker; - /** * are we currently calling this listener */ int calling; - - /** - * condvar where active listeners wait - */ - condvar_t *condvar; }; /** * create a listener entry */ -static entry_t *entry_create(listener_t *listener, bool blocker) +static entry_t *entry_create(listener_t *listener) { - entry_t *this = malloc_thing(entry_t); - - this->listener = listener; - this->blocker = blocker; - this->calling = 0; - this->condvar = condvar_create(CONDVAR_TYPE_DEFAULT); + entry_t *this; + INIT(this, + .listener = listener, + ); return this; } @@ -97,7 +85,6 @@ static entry_t *entry_create(listener_t *listener, bool blocker) */ static void entry_destroy(entry_t *entry) { - entry->condvar->destroy(entry->condvar); free(entry); } @@ -105,7 +92,7 @@ METHOD(bus_t, add_listener, void, private_bus_t *this, listener_t *listener) { this->mutex->lock(this->mutex); - this->listeners->insert_last(this->listeners, entry_create(listener, FALSE)); + this->listeners->insert_last(this->listeners, entry_create(listener)); this->mutex->unlock(this->mutex); } @@ -188,16 +175,7 @@ static bool log_cb(entry_t *entry, log_data_t *data) if (!entry->listener->log(entry->listener, data->group, data->level, data->thread, data->ike_sa, data->format, args)) { - if (entry->blocker) - { - entry->blocker = FALSE; - entry->condvar->signal(entry->condvar); - entry->calling--; - } - else - { - entry_destroy(entry); - } + entry_destroy(entry); va_end(args); return TRUE; } @@ -244,16 +222,8 @@ METHOD(bus_t, log_, void, static void unregister_listener(private_bus_t *this, entry_t *entry, enumerator_t *enumerator) { - if (entry->blocker) - { - entry->blocker = FALSE; - entry->condvar->signal(entry->condvar); - } - else - { - entry_destroy(entry); - } this->listeners->remove_at(this->listeners, enumerator); + entry_destroy(entry); } METHOD(bus_t, alert, void,