Small cleanups in sd-varlink and sd-json (#41861)
This commit is contained in:
@@ -5294,10 +5294,8 @@ _public_ int sd_json_dispatch_full(
|
||||
done++;
|
||||
|
||||
} else {
|
||||
if (flags & SD_JSON_ALLOW_EXTENSIONS) {
|
||||
json_log(value, flags|SD_JSON_DEBUG, 0, "Unrecognized object field '%s', assuming extension.", sd_json_variant_string(key));
|
||||
if (flags & SD_JSON_ALLOW_EXTENSIONS)
|
||||
continue;
|
||||
}
|
||||
|
||||
json_log(value, flags, 0, "Unexpected object field '%s'.", sd_json_variant_string(key));
|
||||
if (flags & SD_JSON_PERMISSIVE)
|
||||
|
||||
@@ -74,9 +74,8 @@ typedef enum VarlinkState {
|
||||
typedef struct sd_varlink {
|
||||
unsigned n_ref;
|
||||
|
||||
sd_varlink_server *server;
|
||||
|
||||
VarlinkState state;
|
||||
sd_varlink_server *server;
|
||||
|
||||
/* Transport layer: input/output buffers, fd passing, output queue, read/write/parse
|
||||
* step functions, sd-event integration (input/output/time event sources, idle
|
||||
@@ -87,6 +86,13 @@ typedef struct sd_varlink {
|
||||
|
||||
unsigned n_pending;
|
||||
|
||||
/* Per-call protocol-upgrade marker: set when the *current* method call carries the
|
||||
* SD_VARLINK_METHOD_UPGRADE flag. Validated by sd_varlink_reply_and_upgrade() to
|
||||
* ensure the caller's contract is honored. The transport-layer "stop reading at the
|
||||
* next message boundary" behavior is governed independently by the JsonStream's
|
||||
* bounded_reads flag. */
|
||||
bool protocol_upgrade;
|
||||
|
||||
sd_varlink_reply_t reply_callback;
|
||||
|
||||
sd_json_variant *current;
|
||||
@@ -102,13 +108,6 @@ typedef struct sd_varlink {
|
||||
size_t n_previous_fds;
|
||||
char *sentinel;
|
||||
|
||||
/* Per-call protocol-upgrade marker: set when the *current* method call carries the
|
||||
* SD_VARLINK_METHOD_UPGRADE flag. Validated by sd_varlink_reply_and_upgrade() to
|
||||
* ensure the caller's contract is honored. The transport-layer "stop reading at the
|
||||
* next message boundary" behavior is governed independently by the JsonStream's
|
||||
* bounded_reads flag. */
|
||||
bool protocol_upgrade:1;
|
||||
|
||||
void *userdata;
|
||||
|
||||
sd_event_source *quit_event_source;
|
||||
@@ -145,8 +144,12 @@ typedef struct sd_varlink_server {
|
||||
sd_event *event;
|
||||
int64_t event_priority;
|
||||
|
||||
unsigned n_connections;
|
||||
Hashmap *by_uid; /* UID_TO_PTR(uid) → UINT_TO_PTR(n_connections) */
|
||||
unsigned n_connections;
|
||||
unsigned connections_max;
|
||||
unsigned connections_per_uid_max;
|
||||
|
||||
bool exit_on_idle;
|
||||
|
||||
void *userdata;
|
||||
|
||||
@@ -155,11 +158,6 @@ typedef struct sd_varlink_server {
|
||||
char *product;
|
||||
char *version;
|
||||
char *url;
|
||||
|
||||
unsigned connections_max;
|
||||
unsigned connections_per_uid_max;
|
||||
|
||||
bool exit_on_idle;
|
||||
} sd_varlink_server;
|
||||
|
||||
#define varlink_log_errno(v, error, fmt, ...) \
|
||||
|
||||
Reference in New Issue
Block a user