diff --git a/include/villas/sample.h b/include/villas/sample.h index 4caf3f927..53230a7cf 100644 --- a/include/villas/sample.h +++ b/include/villas/sample.h @@ -45,6 +45,7 @@ struct sample { atomic_int refcnt; /**< Reference counter. */ struct pool *pool; /**< This sample is belong to this memory pool. */ + struct node *source; /**< The node from which this sample originates. */ /** All timestamps are seconds / nano seconds after 1.1.1970 UTC */ struct { diff --git a/lib/node.c b/lib/node.c index b4aa9dc02..9bfe0a4c6 100644 --- a/lib/node.c +++ b/lib/node.c @@ -38,6 +38,9 @@ int node_read(struct node *n, struct sample *smps[], unsigned cnt) nread = n->_vt->read(n, smps, cnt); } + for (int i = 0; i < nread; i++) + smps[i]->source = n; + return nread; }