sd-varlink: suppress one log message when callback already successfully enqueued an error response

Follow-up for d2ebf5cc1d.

The detailed error response is already logged, hence not necessary to
log again with the errno converted from the error response, which typically
less informative, e.g.
===
varlink-26-26: Setting state idle-server
varlink-26-26: Received message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"service":""}}
varlink-26-26: Changing state idle-server → processing-method
varlink-26-26: Sending message: {"error":"io.systemd.UserDatabase.BadService","parameters":{}}
varlink-26-26: Changing state processing-method → processed-method
varlink-26-26: Callback for io.systemd.UserDatabase.GetUserRecord returned error: Invalid request descriptor
varlink-26-26: Changing state processed-method → idle-server
varlink-26-26: Got POLLHUP from socket.
===
This commit is contained in:
Yu Watanabe
2024-10-31 22:58:35 +01:00
committed by Lennart Poettering
parent e4a4a5bd2b
commit 4d8e5fefae
+5 -7
View File
@@ -1386,17 +1386,15 @@ static int varlink_dispatch_method(sd_varlink *v) {
if (!invalid) {
r = callback(v, parameters, flags, v->userdata);
if (r < 0) {
if (r < 0 && VARLINK_STATE_WANTS_REPLY(v->state)) {
varlink_log_errno(v, r, "Callback for %s returned error: %m", method);
/* We got an error back from the callback. Propagate it to the client if the
* method call remains unanswered. */
if (VARLINK_STATE_WANTS_REPLY(v->state)) {
r = sd_varlink_error_errno(v, r);
/* If we didn't manage to enqueue an error response, then fail the connection completely. */
if (r < 0 && VARLINK_STATE_WANTS_REPLY(v->state))
goto fail;
}
r = sd_varlink_error_errno(v, r);
/* If we didn't manage to enqueue an error response, then fail the connection completely. */
if (r < 0 && VARLINK_STATE_WANTS_REPLY(v->state))
goto fail;
}
}
} else if (VARLINK_STATE_WANTS_REPLY(v->state)) {