summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-02-02 16:59:56 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-02-02 16:59:44 -0500
commitaaf3659fafa3151e9ac685a9c07a2fa97113d30e (patch)
treef2460ef7c6207641f97aea1bb38397118a417216
parentc0b3a0b5621bf7bb9091fd097ddcb3257788ade4 (diff)
eldbus: do not require error return when adding/removing signal matches
this forces the functions to be synchronous and blocks (potentially forever)
-rw-r--r--src/lib/eldbus/eldbus_signal_handler.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/lib/eldbus/eldbus_signal_handler.c b/src/lib/eldbus/eldbus_signal_handler.c
index 164bf5eb7c..e577ddc1bb 100644
--- a/src/lib/eldbus/eldbus_signal_handler.c
+++ b/src/lib/eldbus/eldbus_signal_handler.c
@@ -78,10 +78,7 @@ eldbus_signal_handler_match_extra_vset(Eldbus_Signal_Handler *sh, va_list ap)
78 78
79 dbus_error_init(&err); 79 dbus_error_init(&err);
80 dbus_bus_remove_match(sh->conn->dbus_conn, 80 dbus_bus_remove_match(sh->conn->dbus_conn,
81 eina_strbuf_string_get(sh->match), &err); 81 eina_strbuf_string_get(sh->match), NULL);
82 if (dbus_error_is_set(&err))
83 ERR("handler(%p): %s - %s", sh, err.name, err.message);
84 EINA_SAFETY_ON_TRUE_RETURN_VAL(dbus_error_is_set(&err), EINA_FALSE);
85 82
86 for (read = va_arg(ap, char *); read; read = va_arg(ap, char *)) 83 for (read = va_arg(ap, char *); read; read = va_arg(ap, char *))
87 { 84 {
@@ -113,23 +110,16 @@ eldbus_signal_handler_match_extra_vset(Eldbus_Signal_Handler *sh, va_list ap)
113 key = NULL; 110 key = NULL;
114 } 111 }
115 112
116 dbus_error_init(&err);
117 dbus_bus_add_match(sh->conn->dbus_conn, 113 dbus_bus_add_match(sh->conn->dbus_conn,
118 eina_strbuf_string_get(sh->match), &err); 114 eina_strbuf_string_get(sh->match), NULL);
119 if (dbus_error_is_set(&err)) 115 return EINA_TRUE;
120 ERR("handler(%p): %s - %s", sh, err.name, err.message);
121 if (!dbus_error_is_set(&err))
122 return EINA_TRUE;
123 116
124 ERR("Error setting new match."); 117 ERR("Error setting new match.");
125 return EINA_FALSE; 118 return EINA_FALSE;
126 119
127error: 120error:
128 dbus_error_init(&err);
129 dbus_bus_add_match(sh->conn->dbus_conn, 121 dbus_bus_add_match(sh->conn->dbus_conn,
130 eina_strbuf_string_get(sh->match), &err); 122 eina_strbuf_string_get(sh->match), NULL);
131 if (dbus_error_is_set(&err))
132 ERR("handler(%p): %s - %s", sh, err.name, err.message);
133 return EINA_FALSE; 123 return EINA_FALSE;
134} 124}
135 125
@@ -178,7 +168,6 @@ _eldbus_signal_handler_add(Eldbus_Connection *conn, const char *sender, const ch
178{ 168{
179 Eldbus_Signal_Handler *sh; 169 Eldbus_Signal_Handler *sh;
180 Eina_Strbuf *match; 170 Eina_Strbuf *match;
181 DBusError err;
182 171
183 EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL); 172 EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL);
184 EINA_SAFETY_ON_NULL_RETURN_VAL(cb, NULL); 173 EINA_SAFETY_ON_NULL_RETURN_VAL(cb, NULL);
@@ -196,11 +185,7 @@ _eldbus_signal_handler_add(Eldbus_Connection *conn, const char *sender, const ch
196 _match_append(match, "interface", interface); 185 _match_append(match, "interface", interface);
197 _match_append(match, "member", member); 186 _match_append(match, "member", member);
198 187
199 dbus_error_init(&err); 188 dbus_bus_add_match(conn->dbus_conn, eina_strbuf_string_get(match), NULL);
200 dbus_bus_add_match(conn->dbus_conn, eina_strbuf_string_get(match), &err);
201 if (dbus_error_is_set(&err))
202 ERR("handler(%p): %s - %s", sh, err.name, err.message);
203 if (dbus_error_is_set(&err)) goto cleanup;
204 189
205 if (sender) 190 if (sender)
206 { 191 {
@@ -242,9 +227,7 @@ _eldbus_signal_handler_clean(Eldbus_Signal_Handler *handler)
242 DBG("clean handler=%p path=%p cb=%p", handler, handler->path, handler->cb); 227 DBG("clean handler=%p path=%p cb=%p", handler, handler->path, handler->cb);
243 dbus_error_init(&err); 228 dbus_error_init(&err);
244 dbus_bus_remove_match(handler->conn->dbus_conn, 229 dbus_bus_remove_match(handler->conn->dbus_conn,
245 eina_strbuf_string_get(handler->match), &err); 230 eina_strbuf_string_get(handler->match), NULL);
246 if (dbus_error_is_set(&err))
247 ERR("error removing handler(%p): %s - %s", handler, err.name, err.message);
248 handler->dangling = EINA_TRUE; 231 handler->dangling = EINA_TRUE;
249} 232}
250 233
@@ -366,4 +349,3 @@ eldbus_signal_handler_connection_get(const Eldbus_Signal_Handler *handler)
366 ELDBUS_SIGNAL_HANDLER_CHECK_RETVAL(handler, NULL); 349 ELDBUS_SIGNAL_HANDLER_CHECK_RETVAL(handler, NULL);
367 return handler->conn; 350 return handler->conn;
368} 351}
369