diff --git a/server/include/msg.h b/server/include/msg.h index d76f9118d..7a3f2778b 100644 --- a/server/include/msg.h +++ b/server/include/msg.h @@ -30,7 +30,7 @@ void msg_swap(struct msg *m); /** Print a raw UDP message in human readable form. * * @param f The file stream - * @param msg A pointer to the message + * @param m A pointer to the message * @return * - 0 on success * - otherwise an error occured diff --git a/server/include/msg_format.h b/server/include/msg_format.h index f738a4638..812129932 100644 --- a/server/include/msg_format.h +++ b/server/include/msg_format.h @@ -15,8 +15,10 @@ #include #endif +#include "config.h" + /** Maximum number of dword values in a message */ -#define MSG_VALUES 16 +#define MSG_VALUES MAX_VALUES /** The current version number for the message format */ #define MSG_VERSION 0 @@ -68,6 +70,7 @@ struct msg uint8_t length; /** The sequence number gets incremented by one for consecutive messages */ uint16_t sequence; + /** The message payload */ union { float f; diff --git a/server/src/cfg.c b/server/src/cfg.c index 6a5058dbd..e3adfe5bd 100644 --- a/server/src/cfg.c +++ b/server/src/cfg.c @@ -75,8 +75,7 @@ int config_parse_global(config_setting_t *cfg, struct settings *set) int config_parse_path(config_setting_t *cfg, struct path **paths, struct node **nodes) { - const char *in_str = NULL; - const char *out_str = NULL; + const char *in, *out, *hook; int enabled = 1; int reverse = 0; @@ -87,24 +86,25 @@ int config_parse_path(config_setting_t *cfg, memset(path, 0, sizeof(struct path)); /* Required settings */ - if (!config_setting_lookup_string(cfg, "in", &in_str)) + if (!config_setting_lookup_string(cfg, "in", &in)) cerror(cfg, "Missing input node for path"); - if (!config_setting_lookup_string(cfg, "out", &out_str)) + if (!config_setting_lookup_string(cfg, "out", &out)) cerror(cfg, "Missing output node for path"); - path->in = node_lookup_name(in_str, *nodes); + path->in = node_lookup_name(in, *nodes); if (!path->in) cerror(cfg, "Invalid input node '%s'"); - path->out = node_lookup_name(out_str, *nodes); + path->out = node_lookup_name(out, *nodes); if (!path->out) - cerror(cfg, "Invalid output node '%s'", out_str); + cerror(cfg, "Invalid output node '%s'", out); /* Optional settings */ config_setting_lookup_bool(cfg, "enabled", &enabled); config_setting_lookup_bool(cfg, "reverse", &reverse); config_setting_lookup_float(cfg, "rate", &path->rate); + path->cfg = cfg; if (enabled) { @@ -133,10 +133,9 @@ int config_parse_path(config_setting_t *cfg, int config_parse_node(config_setting_t *cfg, struct node **nodes) { - const char *remote_str = NULL; - const char *local_str = NULL; - struct node *node; + const char *remote, *local, *key; + /* Allocate memory */ node = (struct node *) malloc(sizeof(struct node)); @@ -150,18 +149,18 @@ int config_parse_node(config_setting_t *cfg, struct node **nodes) if (!node->name) cerror(cfg, "Missing node name"); - if (!config_setting_lookup_string(cfg, "remote", &remote_str)) + if (!config_setting_lookup_string(cfg, "remote", &remote)) cerror(cfg, "Missing remote address for node '%s'", node->name); - if (!config_setting_lookup_string(cfg, "local", &local_str)) + if (!config_setting_lookup_string(cfg, "local", &local)) cerror(cfg, "Missing local address for node '%s'", node->name); - if (resolve_addr(local_str, &node->local, AI_PASSIVE)) - cerror(cfg, "Failed to resolve local address '%s' of node '%s'", local_str, node->name); + if (resolve_addr(local, &node->local, AI_PASSIVE)) + cerror(cfg, "Failed to resolve local address '%s' of node '%s'", local, node->name); - if (resolve_addr(remote_str, &node->remote, 0)) - cerror(cfg, "Failed to resolve remote address '%s' of node '%s'", remote_str, node->name); + if (resolve_addr(remote, &node->remote, 0)) + cerror(cfg, "Failed to resolve remote address '%s' of node '%s'", remote, node->name); config_setting_t *cfg_netem = config_setting_get_member(cfg, "netem"); if (cfg_netem) { diff --git a/server/src/msg.c b/server/src/msg.c index 5f8941bc9..002e7f7bf 100644 --- a/server/src/msg.c +++ b/server/src/msg.c @@ -76,7 +76,6 @@ int msg_send(struct msg *m, struct node *n) perror("Failed sendto"); debug(10, "Message sent to node '%s'", n->name); - if (V >= 10) msg_fprint(stdout, m); return 0; } @@ -94,7 +93,6 @@ int msg_recv(struct msg *m, struct node *n) msg_swap(m); debug(10, "Message received from node '%s'", n->name); - if (V >= 10) msg_fprint(stdout, m); return 0; } diff --git a/server/src/server.c b/server/src/server.c index 1dbc02473..5b2231595 100644 --- a/server/src/server.c +++ b/server/src/server.c @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) if (stat("/sys/kernel/realtime", &st)) warn("Use a RT-preempt patched Linux for lower latencies!"); else - debug(3, "This is a realtime patched kernel"); + info("Server is running on a realtime patched kernel"); /* Use FIFO scheduler with realtime priority */ if (settings.priority) {