From 68cb6c1f496114c6baa7d8b195801e1cc7e6adc1 Mon Sep 17 00:00:00 2001
From: Sven Gestegard Robertz <sven.robertz@cs.lth.se>
Date: Fri, 21 Nov 2014 23:17:39 +0100
Subject: [PATCH] packet length is excluding tag, fixed for version packet

---
 lib/c/labcomm_encoder.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/c/labcomm_encoder.c b/lib/c/labcomm_encoder.c
index 973ac78..4085bbd 100644
--- a/lib/c/labcomm_encoder.c
+++ b/lib/c/labcomm_encoder.c
@@ -64,8 +64,12 @@ struct labcomm_encoder *labcomm_encoder_new(
                          result->writer->action_context, 
                          LABCOMM_VERSION, NULL, CURRENT_VERSION);
     labcomm_write_packed32(result->writer, LABCOMM_VERSION);
+#ifdef LENGTH_INCL_TAG    
     length = (labcomm_size_packed32(LABCOMM_VERSION) +
               labcomm_size_string(CURRENT_VERSION));
+#else
+    length = labcomm_size_string(CURRENT_VERSION);
+#endif
     labcomm_write_packed32(result->writer, length);
     labcomm_write_string(result->writer, CURRENT_VERSION);
     labcomm_writer_end(result->writer, result->writer->action_context);
-- 
GitLab