diff --git a/include/villas/node.h b/include/villas/node.h index 7cb8394db..7c09de010 100644 --- a/include/villas/node.h +++ b/include/villas/node.h @@ -50,6 +50,8 @@ struct node qptr_t sent; /**< Number of samples sent / written to this node. */ qptr_t received; /**< Number of samples received / read from this node. */ + + qptr_t seq_num; /**< Manual sequence number in case a node doesn't support it. */ enum node_state { NODE_INVALID, /**< This node object is not in a valid state. */ diff --git a/lib/hooks/hooks-internal.c b/lib/hooks/hooks-internal.c index f260e0a73..26958703c 100644 --- a/lib/hooks/hooks-internal.c +++ b/lib/hooks/hooks-internal.c @@ -67,10 +67,6 @@ int hook_drop(struct path *p, struct hook *h, int when, struct sample *smps[], s { int i, ok, dist; - /** Don't check the sequence number order in case of gtnet-skt without header */ - if(!strcmp(p->in->_vt->name, "socket") && !GTNET_SKT_HEADER) - return cnt; - for (i = 0, ok = 0; i < cnt; i++) { h->last = smps[i]; diff --git a/lib/node.c b/lib/node.c index 7baa1a407..dca14ae83 100644 --- a/lib/node.c +++ b/lib/node.c @@ -113,6 +113,8 @@ int node_start(struct node *n) if (ret == 0) n->state = NODE_RUNNING; + n->seq_num = 0; /** @todo is it the appropriate place to initialize seq_num? */ + return ret; } diff --git a/lib/nodes/socket.c b/lib/nodes/socket.c index f6c3e3f12..ecffea3c7 100644 --- a/lib/nodes/socket.c +++ b/lib/nodes/socket.c @@ -276,7 +276,7 @@ int socket_read(struct node *n, struct sample *smps[], unsigned cnt) smp->ts.origin.tv_sec = header[1]; smp->ts.origin.tv_nsec = header[2]; #else - smp->sequence = -1; + smp->sequence = n->seq_num++; smp->ts.origin.tv_sec = -1; smp->ts.origin.tv_nsec = -1; #endif