1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

some cleanup

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@176 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-08-31 14:43:28 +00:00
parent 40c0899ca5
commit 183b5e158a
5 changed files with 21 additions and 21 deletions

View file

@ -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

View file

@ -15,8 +15,10 @@
#include <endian.h>
#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;

View file

@ -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) {

View file

@ -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;
}

View file

@ -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) {