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 2021/09/17 18:40:46 UTC

[plc4x] 05/08: fix(plc4go): fixed driverManager.go omitting the transport path

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 abcf1a5b975594c694feeda48bba0db6ff5fb75f
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Sep 17 20:31:30 2021 +0200

    fix(plc4go): fixed driverManager.go omitting the transport path
---
 plc4go/pkg/plc4go/driverManager.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/plc4go/pkg/plc4go/driverManager.go b/plc4go/pkg/plc4go/driverManager.go
index 2b02e09..a8f0030 100644
--- a/plc4go/pkg/plc4go/driverManager.go
+++ b/plc4go/pkg/plc4go/driverManager.go
@@ -151,11 +151,13 @@ func (m PlcDriverManger) GetConnection(connectionString string) <-chan PlcConnec
 		}()
 		return ch
 	}
+	log.Debug().Stringer("connectionUrl", connectionUrl).Msgf("got driver %s", driver.GetProtocolName())
 
 	// If a transport is provided alongside the driver, the URL content is decoded as "opaque" data
 	// Then we have to re-parse that to get the transport code as well as the host & port information.
 	var transportName string
 	var transportConnectionString string
+	var transportPath string
 	if len(connectionUrl.Opaque) > 0 {
 		log.Trace().Msg("we handling a opaque connectionUrl")
 		connectionUrl, err := url.Parse(connectionUrl.Opaque)
@@ -169,11 +171,13 @@ func (m PlcDriverManger) GetConnection(connectionString string) <-chan PlcConnec
 		}
 		transportName = connectionUrl.Scheme
 		transportConnectionString = connectionUrl.Host
+		transportPath = connectionUrl.Path
 	} else {
 		log.Trace().Msg("we handling a non-opaque connectionUrl")
 		// If no transport was provided the driver has to provide a default transport.
 		transportName = driver.GetDefaultTransport()
 		transportConnectionString = connectionUrl.Host
+		transportPath = connectionUrl.Path
 	}
 	log.Debug().
 		Str("transportName", transportName).
@@ -193,6 +197,7 @@ func (m PlcDriverManger) GetConnection(connectionString string) <-chan PlcConnec
 	transportUrl := url.URL{
 		Scheme: transportName,
 		Host:   transportConnectionString,
+		Path:   transportPath,
 	}
 	log.Debug().Stringer("transportUrl", &transportUrl).Msg("Assembled transport url")