This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 57eacfb43b fix(plc4go/cbus): try read a bit more greedy on confirm
57eacfb43b is described below

commit 57eacfb43bbc20e0704d88a5ef972df028c46809
Author: Sebastian Rühl <[email protected]>
AuthorDate: Tue Mar 28 16:48:18 2023 +0200

    fix(plc4go/cbus): try read a bit more greedy on confirm
---
 plc4go/internal/cbus/MessageCodec.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plc4go/internal/cbus/MessageCodec.go 
b/plc4go/internal/cbus/MessageCodec.go
index 635fd23c4a..66568ec09b 100644
--- a/plc4go/internal/cbus/MessageCodec.go
+++ b/plc4go/internal/cbus/MessageCodec.go
@@ -89,15 +89,19 @@ func (m *MessageCodec) Receive() (spi.Message, error) {
        confirmation := false
        // Fill the buffer
        {
-               if err := ti.FillBuffer(func(_ uint, currentByte byte, reader 
*bufio.Reader) bool {
+               if err := ti.FillBuffer(func(pos uint, currentByte byte, reader 
*bufio.Reader) bool {
                        log.Trace().Uint8("byte", currentByte).Msg("current 
byte")
                        switch currentByte {
                        case
                                readWriteModel.ResponseTermination_CR,
                                readWriteModel.ResponseTermination_LF:
                                return false
+                       case 
byte(readWriteModel.ConfirmationType_CONFIRMATION_SUCCESSFUL):
+                               confirmation = true
+                               // In case we have directly more data in the 
buffer after a confirmation
+                               _, err := reader.Peek(int(pos + 1))
+                               return err == nil
                        case
-                               
byte(readWriteModel.ConfirmationType_CONFIRMATION_SUCCESSFUL),
                                
byte(readWriteModel.ConfirmationType_NOT_TRANSMITTED_TO_MANY_RE_TRANSMISSIONS),
                                
byte(readWriteModel.ConfirmationType_NOT_TRANSMITTED_CORRUPTION),
                                
byte(readWriteModel.ConfirmationType_NOT_TRANSMITTED_SYNC_LOSS),

Reply via email to