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/10 10:27:54 UTC

[plc4x] branch develop updated: fix(plc4go/cbus): removed spamming log statement

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 e81262399 fix(plc4go/cbus): removed spamming log statement
e81262399 is described below

commit e81262399c4359385ce239b968671c27938d6d1c
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Aug 10 12:27:48 2022 +0200

    fix(plc4go/cbus): removed spamming log statement
---
 plc4go/internal/cbus/Connection.go | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/plc4go/internal/cbus/Connection.go b/plc4go/internal/cbus/Connection.go
index 56258d7b7..c35e3eb7e 100644
--- a/plc4go/internal/cbus/Connection.go
+++ b/plc4go/internal/cbus/Connection.go
@@ -275,8 +275,8 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
 
 	log.Debug().Msg("Starting subscription handler")
 	go func() {
+		log.Debug().Msg("Subscription handler stated")
 		for c.IsConnected() {
-			log.Debug().Msg("Handling incoming message")
 			for monitoredSal := range c.messageCodec.(*MessageCodec).monitoredSALs {
 				for _, subscriber := range c.subscribers {
 					if ok := subscriber.handleMonitoredSal(monitoredSal); ok {
@@ -285,16 +285,14 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
 				}
 			}
 		}
+		log.Info().Msg("Ending subscription handler")
 	}()
-	log.Debug().Msg("Subscription handler stated")
 
 	log.Debug().Msg("Starting default incoming message handler")
 	go func() {
+		log.Debug().Msg("default incoming message handler started")
 		for c.IsConnected() {
-			log.Debug().Msg("Polling data")
-			incomingMessageChannel := c.messageCodec.GetDefaultIncomingMessageChannel()
-			select {
-			case message := <-incomingMessageChannel:
+			for message := range c.messageCodec.GetDefaultIncomingMessageChannel() {
 				switch message := message.(type) {
 				case readWriteModel.CBusMessageToClientExactly:
 					switch reply := message.GetReply().(type) {
@@ -307,19 +305,18 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
 									calReply := encodedReply.GetCalReply()
 									if ok := subscriber.handleMonitoredMMI(calReply); ok {
 										log.Debug().Msgf("%v handled\n%s", subscriber, calReply)
+										continue
 									}
 								}
 							}
 						}
 					}
 				}
-				log.Debug().Msgf("Received \n%v", message)
-			case <-time.After(20 * time.Millisecond):
+				log.Debug().Msgf("Received unhandled \n%v", message)
 			}
 		}
 		log.Info().Msg("Ending default incoming message handler")
 	}()
-	log.Debug().Msg("default incoming message handler started")
 }
 
 func (c *Connection) sendCalDataWrite(ch chan plc4go.PlcConnectionConnectResult, paramNo readWriteModel.Parameter, parameterValue readWriteModel.ParameterValue, requestContext *readWriteModel.RequestContext, cbusOptions *readWriteModel.CBusOptions) bool {