summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-10-29 19:10:11 +0100
committerAlfred E. Heggestad <aeh@db.org>2015-10-29 19:10:11 +0100
commitda8cf2621a3e1a04b3bcb10f82d5a70393ecd1d6 (patch)
treeb5ef1d9edcbe42fc7fe5180dc07c1690cc649162
parent039c4b1b627b86b041d76b483db2b9532452f6f4 (diff)
ua: only send UA_EVENT_UNREGISTERING event if we have register-clients
-rw-r--r--src/ua.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ua.c b/src/ua.c
index 461d223..45102e4 100644
--- a/src/ua.c
+++ b/src/ua.c
@@ -207,7 +207,8 @@ void ua_unregister(struct ua *ua)
if (!ua)
return;
- ua_event(ua, UA_EVENT_UNREGISTERING, NULL, NULL);
+ if (!list_isempty(&ua->regl))
+ ua_event(ua, UA_EVENT_UNREGISTERING, NULL, NULL);
for (le = ua->regl.head; le; le = le->next) {
struct reg *reg = le->data;
@@ -506,7 +507,8 @@ static void ua_destructor(void *arg)
list_unlink(&ua->le);
- ua_event(ua, UA_EVENT_UNREGISTERING, NULL, NULL);
+ if (!list_isempty(&ua->regl))
+ ua_event(ua, UA_EVENT_UNREGISTERING, NULL, NULL);
list_flush(&ua->calls);
list_flush(&ua->regl);