From b5162e04cbcc8c50da856b0088a49d4d450d1b41 Mon Sep 17 00:00:00 2001 From: Grabt234 Date: Thu, 1 Aug 2024 20:26:02 +0200 Subject: [PATCH] Fix: Fixing data proc handling --- Routines/TCPRXRoutine.go | 7 ++++++- main.go | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Routines/TCPRXRoutine.go b/Routines/TCPRXRoutine.go index 4908970..66807a3 100644 --- a/Routines/TCPRXRoutine.go +++ b/Routines/TCPRXRoutine.go @@ -70,8 +70,13 @@ func HandleTCPReceivals(configJson map[string]interface{}, loggingChannel chan m } byteArray = append(byteArray, buffer[:bytesRead]...) + // check if byte array is large enough - if len(byteArray) > 512 { + for { + + if len(byteArray) < 512{ + break + } // Expected byte Format // |Transport Header(2)| [Session Header(23)|Session Data(x)] | diff --git a/main.go b/main.go index 94c9a78..49e7716 100644 --- a/main.go +++ b/main.go @@ -7,10 +7,17 @@ import ( "time" "github.com/Sense-Scape/Go_TCP_Websocket_Adapter/v2/Routines" "github.com/rs/zerolog" + // _ "net/http/pprof" + // "net/http" ) func main() { + // uncomment to allow remote memory debugging + // go func() { + // log.Println(http.ListenAndServe("localhost:6060", nil)) + // }() + // Create a decoder to read JSON data from the file // Open the JSON file for reading routineCompleteChannel := make(chan bool)