connection: broadcast and signaling hide non-fatal errors
authorDjalal Harouni <tixxdz@opendz.org>
Fri, 3 Oct 2014 23:21:59 +0000 (00:21 +0100)
committerDaniel Mack <daniel@zonque.org>
Sat, 4 Oct 2014 08:26:43 +0000 (10:26 +0200)
Broadcast is one way, we should not care for receivers or their errors.

Currently we may return an error on custom endpoints if the last
receiver is not authorized to see name's of the sender. Even if we
have signaled all previous receivers, if we fail for the last one we may
return an error.

Improve this by just ignoring this type of error. We hide non-fatal
errors, and we return an error only if kdbus_meta_append() fails since
it can not recover. kdbus_meta_append() fails with -ENOMEM, its logic
can perhaps be improved later to have at least a nofail version where we
can recover.

And from D-Bus spec:

"Errors

Messages of type ERROR are most commonly replies to a METHOD_CALL, but
may be returned in reply to any kind of message. The message bus for
example will return an ERROR in reply to a signal emission if the bus
does not have enough memory to send the signal. "

So take this shortcut here, and hide non-fatal errors.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection.c

index 7773a71cf90c502e2306cbf4387406693c03f15f..e3cb1fb85f5fccba8984193c1dbf07b79ef912ec 100644 (file)
@@ -597,6 +597,9 @@ static int kdbus_conn_broadcast(struct kdbus_ep *ep,
                kdbus_conn_entry_insert(conn_dst, conn_src, kmsg, NULL);
        }
 
+       /* Hide non-fatal errors when doing broadcast */
+       ret = 0;
+
 exit_unlock:
        up_read(&bus->conn_rwlock);
        return ret;