diff --git a/server/Makefile b/server/Makefile index a99b24aa7..06123d5e5 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,9 +1,11 @@ TARGETS = server send random receive test -# Common dependencies for all binaries -OBJS = if.o utils.o msg.o node.o cfg.o tc.o hooks.o list.o path.o hist.o log.o +# Common objs +OBJS = msg.o cfg.o path.o node.o hooks.o +# Helper libs +OBJS += utils.o list.o hist.o log.o timing.o # Node types -OBJS += socket.o file.o +OBJS += file.o socket.o if.o tc.o VPATH = src @@ -46,12 +48,12 @@ endif all: $(TARGETS) # Dependencies for individual binaries -server: server.o $(OBJS) -send: send.o $(OBJS) +server: server.o $(OBJS) +send: send.o $(OBJS) receive: receive.o $(OBJS) -random: random.o $(OBJS) -test: test.o $(OBJS) - +test: test.o $(OBJS) +random: random.o $(OBJS) + protected: CFLAGS += -DPROTECT -DVALID_UNTIL=$(shell date -d "now +5months" +%s) -s -O3 -fvisibility=hidden protected: clean strip diff --git a/server/include/file.h b/server/include/file.h index bc42c600e..f80cee969 100644 --- a/server/include/file.h +++ b/server/include/file.h @@ -29,9 +29,9 @@ struct file { const char *mode; /**< The mode for fopen() which is used for the out file. */ + struct timespec offset; /**< An offset between the timestamp in the input file and the current time */ double rate; /**< The sending rate. */ int tfd; /**< Timer file descriptor. Blocks until 1/rate seconds are elapsed. */ - int timestamp; /**< Bolean flag, prepend timestamp in front of message */ }; /** @see node_vtable::init */ diff --git a/server/src/path.c b/server/src/path.c index f0ff39b72..efd9c175d 100644 --- a/server/src/path.c +++ b/server/src/path.c @@ -93,15 +93,19 @@ skip: for(;;) { p->previous = &p->pool[(p->received-1) % p->poolsize]; p->current = &p->pool[ p->received % p->poolsize]; + if (settings.debug >= 10) + msg_fprint(stdout, p->current); + p->received++; /* Check header fields */ if (msg_verify(p->current)) { p->invalid++; + warn("Received invalid message!"); goto skip; /* Drop message */ } - /* Update histogram and handle wrap-around of sequence number */ + /* Handle wrap-around of sequence number */ int dist = (UINT16_MAX + p->current->sequence - p->previous->sequence) % UINT16_MAX; if (dist > UINT16_MAX / 2) dist -= UINT16_MAX; diff --git a/server/src/socket.c b/server/src/socket.c index 693af3c3d..bb238123d 100644 --- a/server/src/socket.c +++ b/server/src/socket.c @@ -288,7 +288,7 @@ int socket_parse(config_setting_t *cfg, struct node *n) cerror(cfg, "Failed to resolve remote address '%s' of node '%s': %s", remote, n->name, gai_strerror(ret)); - /** @todo Netem settings are not usable AF_UNIX */ + /** @todo Netem settings are not usable with AF_UNIX */ config_setting_t *cfg_netem = config_setting_get_member(cfg, "netem"); if (cfg_netem) { s->netem = alloc(sizeof(struct netem)); diff --git a/server/src/test.c b/server/src/test.c index a2e2763cb..8f9731793 100644 --- a/server/src/test.c +++ b/server/src/test.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) printf("Simulator2Simulator Server %s (built on %s %s)\n", BLU(VERSION), MAG(__DATE__), MAG(__TIME__)); - printf(" Copyright 2015, Institute for Automation of Complex Power Systems, EONERC\n"); + printf(" copyright 2014-2015, Institute for Automation of Complex Power Systems, EONERC\n"); printf(" Steffen Vogel \n"); exit(EXIT_FAILURE); diff --git a/server/src/utils.c b/server/src/utils.c index 4808abd73..9d3e55409 100644 --- a/server/src/utils.c +++ b/server/src/utils.c @@ -19,8 +19,8 @@ #include #ifdef ENABLE_OPAL_ASYNC -#define RTLAB -#include + #define RTLAB + #include #endif #include "config.h"