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 2022/09/14 12:01:34 UTC

[plc4x] 02/02: fix(plc4go/cbus): don't return connection instance on connection error

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 b6d94c73c114362dc1b7c732a315f71d922bdf44
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Sep 14 14:01:24 2022 +0200

    fix(plc4go/cbus): don't return connection instance on connection error
---
 plc4go/internal/cbus/Connection.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plc4go/internal/cbus/Connection.go b/plc4go/internal/cbus/Connection.go
index 567a689fa..e55596c34 100644
--- a/plc4go/internal/cbus/Connection.go
+++ b/plc4go/internal/cbus/Connection.go
@@ -114,7 +114,8 @@ func (c *Connection) Connect() <-chan plc4go.PlcConnectionConnectResult {
 	go func() {
 		err := c.messageCodec.Connect()
 		if err != nil {
-			ch <- _default.NewDefaultPlcConnectionConnectResult(c, err)
+			ch <- _default.NewDefaultPlcConnectionConnectResult(nil, err)
+			return
 		}
 
 		// For testing purposes we can skip the waiting for a complete connection
@@ -123,7 +124,7 @@ func (c *Connection) Connect() <-chan plc4go.PlcConnectionConnectResult {
 			log.Warn().Msg("Connection used in an unsafe way. !!!DON'T USE IN PRODUCTION!!!")
 			// Here we write directly and don't wait till the connection is "really" connected
 			// Note: we can't use fireConnected here as it's guarded against m.driverContext.awaitSetupComplete
-			ch <- _default.NewDefaultPlcConnectionConnectResult(c, err)
+			ch <- _default.NewDefaultPlcConnectionConnectResult(c, nil)
 			c.SetConnected(true)
 			return
 		}