From e59ed05c66cf063baae99865bc7c6e2349eb149a Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Mon, 10 Jun 2019 12:55:18 +0300 Subject: fix off-by-one error. Signed-off-by: Gediminas Jakutis --- src/daemon/main.c | 4 ++-- src/device/device_network.cpp | 2 +- src/device/main.ino | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/daemon/main.c b/src/daemon/main.c index fd7932e..35c7677 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -118,7 +118,7 @@ skiprecv: tlv_pack(&pack, &field); tlv_packet_finalize(&pack); tlv_destroy(&field); - net_send(__progstate.nd, pack.data, pack.cursor + 1); + net_send(__progstate.nd, pack.data, pack.cursor); tlv_packet_reset(&pack); } } @@ -154,7 +154,7 @@ static int does_my_kokoro_go_doki_doki(struct tlv *tlv) fprintf(stderr, "heartbeat.\n"); } - ret = net_send(__progstate.nd, pack.data, pack.cursor + 1); + ret = net_send(__progstate.nd, pack.data, pack.cursor); } return ret; diff --git a/src/device/device_network.cpp b/src/device/device_network.cpp index bd8467b..9dfe50e 100644 --- a/src/device/device_network.cpp +++ b/src/device/device_network.cpp @@ -91,7 +91,7 @@ IPAddress *discover_client(const int port) do { udp_init_packet_expaddr(bcastip, port); - udp_push(pack.data, pack.cursor + 1); + udp_push(pack.data, pack.cursor); udp_flush(); delay(5); diff --git a/src/device/main.ino b/src/device/main.ino index 49cb0e7..674db85 100644 --- a/src/device/main.ino +++ b/src/device/main.ino @@ -104,7 +104,7 @@ void loop(void) if (!progstate.hbcounter) { udp_init_packet(com_port); - udp_push(progstate.heartbeat.data, progstate.heartbeat.cursor + 1); + udp_push(progstate.heartbeat.data, progstate.heartbeat.cursor); udp_flush(); progstate.hbcounter = seconds(30); } -- cgit v1.2.3