From b7a02c7888914420bceb752e73ac6eba70546110 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Wed, 2 Sep 2015 15:45:36 +0200
Subject: [PATCH] Call reader_start and reader_end for version as well.

---
 examples/twoway/decimating.c     | 2 +-
 examples/twoway/introspecting.c  | 2 +-
 lib/c/2014/labcomm2014_decoder.c | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/twoway/decimating.c b/examples/twoway/decimating.c
index 705f4ce..f6696db 100644
--- a/examples/twoway/decimating.c
+++ b/examples/twoway/decimating.c
@@ -111,7 +111,7 @@ static int wrap_reader_start(
 {
   struct decimating_private *decimating = action_context->context;
 
-  if (value == NULL) {
+  if (value == NULL && local_index != 0) {
     int *decimation, amount;
     
     labcomm2014_scheduler_data_lock(decimating->scheduler);
diff --git a/examples/twoway/introspecting.c b/examples/twoway/introspecting.c
index 87bffeb..6491dc6 100644
--- a/examples/twoway/introspecting.c
+++ b/examples/twoway/introspecting.c
@@ -161,7 +161,7 @@ static int wrap_reader_start(
 {
   struct introspecting_private *introspecting = action_context->context;
   
-  if (value == NULL) {
+  if (value == NULL && local_index != 0) {
     struct handles_signature *handles_signature;
 
     handles_signature = labcomm2014_memory_alloc(introspecting->memory, 1,
diff --git a/lib/c/2014/labcomm2014_decoder.c b/lib/c/2014/labcomm2014_decoder.c
index 5b64182..b38de40 100644
--- a/lib/c/2014/labcomm2014_decoder.c
+++ b/lib/c/2014/labcomm2014_decoder.c
@@ -358,6 +358,10 @@ static int do_decode_one(struct labcomm2014_decoder *d)
     if (result < 0) {
       goto out;
     }
+    labcomm2014_reader_start(d->reader, d->reader->action_context,
+                             0, 0, NULL, NULL);
+    labcomm2014_reader_end(d->reader, d->reader->action_context);
+
   } else if (! d->version_ok) {
     DEBUG_FPRINTF(stderr, "No VERSION %d %d\n", remote_index, length);
     result = -ECONNRESET;
-- 
GitLab