mirror of
https://github.com/systemd/systemd
synced 2024-10-15 12:34:37 +00:00
varlink: never turn method call handler errors into connection errors
Let's make sure method call handlers failing will result in that very method call failing but not the whole connection. We mostly got that right, except for "oneway" calls where the method reply is supposed to be eaten up, but wasn't. Fix that.
This commit is contained in:
parent
6bcc12325b
commit
c931c871aa
|
@ -1350,9 +1350,7 @@ static int varlink_dispatch_method(Varlink *v) {
|
|||
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 (v->state == VARLINK_PROCESSED_METHOD)
|
||||
r = 0; /* already processed */
|
||||
else if (!FLAGS_SET(flags, VARLINK_METHOD_ONEWAY)) {
|
||||
if (v->state != VARLINK_PROCESSED_METHOD && !FLAGS_SET(flags, VARLINK_METHOD_ONEWAY)) {
|
||||
r = varlink_error_errno(v, r);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -1363,8 +1361,7 @@ static int varlink_dispatch_method(Varlink *v) {
|
|||
r = varlink_errorb(v, VARLINK_ERROR_METHOD_NOT_FOUND, JSON_BUILD_OBJECT(JSON_BUILD_PAIR("method", JSON_BUILD_STRING(method))));
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else
|
||||
r = 0;
|
||||
}
|
||||
|
||||
switch (v->state) {
|
||||
|
||||
|
@ -1386,7 +1383,7 @@ static int varlink_dispatch_method(Varlink *v) {
|
|||
assert_not_reached();
|
||||
}
|
||||
|
||||
return r;
|
||||
return 1;
|
||||
|
||||
invalid:
|
||||
r = -EINVAL;
|
||||
|
|
Loading…
Reference in a new issue