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/08/17 09:13:09 UTC

[plc4x] 02/03: fix(plc4go/spi): disconnect message code on close

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 7c814cc27391658ea48bee3b663a0525316e7912
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Aug 17 11:12:24 2022 +0200

    fix(plc4go/spi): disconnect message code on close
---
 plc4go/spi/default/DefaultConnection.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plc4go/spi/default/DefaultConnection.go b/plc4go/spi/default/DefaultConnection.go
index aedaad809..475d638da 100644
--- a/plc4go/spi/default/DefaultConnection.go
+++ b/plc4go/spi/default/DefaultConnection.go
@@ -255,6 +255,9 @@ func (d *defaultConnection) BlockingClose() {
 
 func (d *defaultConnection) Close() <-chan plc4go.PlcConnectionCloseResult {
 	log.Trace().Msg("close connection")
+	if err := d.GetMessageCodec().Disconnect(); err != nil {
+		log.Warn().Err(err).Msg("Error disconnecting message code")
+	}
 	err := d.GetTransportInstance().Close()
 	d.SetConnected(false)
 	ch := make(chan plc4go.PlcConnectionCloseResult)