static VARLINK_DEFINE_ERROR(PermissionDenied);
+static VARLINK_DEFINE_ERROR(ExpectedMore);
+
/* As per https://varlink.org/Service */
VARLINK_DEFINE_INTERFACE(
org_varlink_service,
&vl_error_MethodNotFound,
&vl_error_MethodNotImplemented,
&vl_error_InvalidParameter,
- &vl_error_PermissionDenied);
+ &vl_error_PermissionDenied,
+ &vl_error_ExpectedMore);
if (v->state == VARLINK_DISCONNECTED)
return varlink_log_errno(v, SYNTHETIC_ERRNO(ENOTCONN), "Not connected.");
+
+ /* If we want to reply with a notify connection but the caller didn't set "more", then return an
+ * error indicating that we expected to be called with "more" set */
+ if (IN_SET(v->state, VARLINK_PROCESSING_METHOD, VARLINK_PENDING_METHOD))
+ return varlink_error(v, VARLINK_ERROR_EXPECTED_MORE, NULL);
+
if (!IN_SET(v->state, VARLINK_PROCESSING_METHOD_MORE, VARLINK_PENDING_METHOD_MORE))
return varlink_log_errno(v, SYNTHETIC_ERRNO(EBUSY), "Connection busy.");
/* These are errors we came up with and squatted the namespace with */
#define VARLINK_ERROR_PERMISSION_DENIED "org.varlink.service.PermissionDenied"
+#define VARLINK_ERROR_EXPECTED_MORE "org.varlink.service.ExpectedMore"