From cab6eea89a0d82710369604ecb51f1cdb122e433 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 19 十月 2023 17:26:34 +0800 Subject: [PATCH] fix --- pkg/plc/plc4x.go | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/plc/plc4x.go b/pkg/plc/plc4x.go index f7abe99..68562a6 100644 --- a/pkg/plc/plc4x.go +++ b/pkg/plc/plc4x.go @@ -33,15 +33,9 @@ if !ok { return nil, false } - //connOK, err := cm.CheckConnect(conn, time.Second*1) - //if err != nil { - // logx.Errorf("ping plc err:%v", err.Error()) - // return nil, false + //if ok, _ := cm.CheckConnect(conn, time.Second); !ok { + // conn.Close() //} - //if connOK { - // return conn, ok - //} - //return nil, false return conn, true } @@ -72,7 +66,6 @@ func GetModbusConnection(ipAddr string) (plc4go.PlcConnection, error) { if conn, ok := connectionManager.GetConnection(ipAddr); ok { - time.Sleep(time.Second * 1) return conn, nil } // 鍒涘缓涓�涓笂涓嬫枃锛屽苟璁剧疆 3 绉掕秴鏃� @@ -84,7 +77,6 @@ return nil, err } connectionManager.AddConnection(ipAddr, conn) - time.Sleep(time.Second * 1) return conn, nil } -- Gitblit v1.8.0