You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/20 09:08:38 UTC

[plc4x] branch develop updated (31a8aa51c3 -> 35bf97a71c)

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

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


    from 31a8aa51c3 fix(plc4go/spi): use LookupEnv instead of GetEnv in test utils
     new 8535bef7c7 refactor(plc4go/spi): use getOrLeaveBool for high log precision too
     new fe996814ae fix(plc4go/spi): avoid unnecessary read on DefaultCodec shutdown
     new 35bf97a71c feat(plc4go/eip): output message before to better understand test failure

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/eip/Reader.go              | 1 +
 plc4go/spi/default/DefaultCodec.go         | 7 +++++--
 plc4go/spi/testutils/TestUtils.go          | 2 +-
 plc4go/spi/transports/TransportInstance.go | 3 ++-
 4 files changed, 9 insertions(+), 4 deletions(-)


[plc4x] 03/03: feat(plc4go/eip): output message before to better understand test failure

Posted by sr...@apache.org.
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

commit 35bf97a71c3d9c7865ba7821c5b0f0952431ef08
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 20 11:08:31 2023 +0200

    feat(plc4go/eip): output message before to better understand test
    failure
---
 plc4go/internal/eip/Reader.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plc4go/internal/eip/Reader.go b/plc4go/internal/eip/Reader.go
index 83980fc6d2..1c2ed4eee6 100644
--- a/plc4go/internal/eip/Reader.go
+++ b/plc4go/internal/eip/Reader.go
@@ -112,6 +112,7 @@ func (m *Reader) Read(ctx context.Context, readRequest apiModel.PlcReadRequest)
 					},
 					func(message spi.Message) error {
 						cipRRData := message.(readWriteModel.CipRRData)
+						m.log.Trace().Msgf("handling:\n%s", cipRRData)
 						unconnectedDataItem := cipRRData.GetTypeIds()[1].(readWriteModel.UnConnectedDataItem)
 						// Convert the eip response into a PLC4X response
 						m.log.Trace().Msg("convert response to PLC4X response")


[plc4x] 01/03: refactor(plc4go/spi): use getOrLeaveBool for high log precision too

Posted by sr...@apache.org.
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

commit 8535bef7c72829b9b4f019fec1f56cea5f461cbf
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 20 10:03:37 2023 +0200

    refactor(plc4go/spi): use getOrLeaveBool for high log precision too
---
 plc4go/spi/testutils/TestUtils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4go/spi/testutils/TestUtils.go b/plc4go/spi/testutils/TestUtils.go
index 492339df42..52651d8ead 100644
--- a/plc4go/spi/testutils/TestUtils.go
+++ b/plc4go/spi/testutils/TestUtils.go
@@ -130,7 +130,7 @@ var (
 )
 
 func init() {
-	highLogPrecision = os.Getenv("PLC4X_TEST_HIGH_TEST_LOG_PRECISION") == "true"
+	getOrLeaveBool("PLC4X_TEST_HIGH_TEST_LOG_PRECISION", &highLogPrecision)
 	if highLogPrecision {
 		zerolog.TimeFieldFormat = time.RFC3339Nano
 	}


[plc4x] 02/03: fix(plc4go/spi): avoid unnecessary read on DefaultCodec shutdown

Posted by sr...@apache.org.
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

commit fe996814aebc9d585e35e23c93f9286ce1d9d215
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 20 10:48:13 2023 +0200

    fix(plc4go/spi): avoid unnecessary read on DefaultCodec shutdown
---
 plc4go/spi/default/DefaultCodec.go         | 7 +++++--
 plc4go/spi/transports/TransportInstance.go | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/plc4go/spi/default/DefaultCodec.go b/plc4go/spi/default/DefaultCodec.go
index 4c7b99bca2..209dff1cd8 100644
--- a/plc4go/spi/default/DefaultCodec.go
+++ b/plc4go/spi/default/DefaultCodec.go
@@ -327,8 +327,12 @@ mainLoop:
 		{
 			syncer := make(chan struct{})
 			go func() {
+				defer close(syncer)
+				if !m.running.Load() {
+					err = errors.New("not running")
+					return
+				}
 				message, err = m.Receive()
-				close(syncer)
 			}()
 			timeoutTimer := time.NewTimer(m.receiveTimeout)
 			select {
@@ -339,7 +343,6 @@ mainLoop:
 				workerLog.Error().Msgf("receive timeout after %s", m.receiveTimeout)
 				continue mainLoop
 			}
-
 		}
 		if err != nil {
 			workerLog.Error().Err(err).Msg("got an error reading from transport")
diff --git a/plc4go/spi/transports/TransportInstance.go b/plc4go/spi/transports/TransportInstance.go
index ee121c3a87..3c73356848 100644
--- a/plc4go/spi/transports/TransportInstance.go
+++ b/plc4go/spi/transports/TransportInstance.go
@@ -22,13 +22,14 @@ package transports
 import (
 	"context"
 	"fmt"
+	"io"
 )
 
 type TransportInstance interface {
 	fmt.Stringer
+	io.Closer
 	Connect() error
 	ConnectWithContext(ctx context.Context) error
-	Close() error
 
 	IsConnected() bool