From e6317664343086409757f4b0869a39b695757afd Mon Sep 17 00:00:00 2001 From: andrea Date: Sun, 27 Nov 2022 12:30:35 +0100 Subject: [PATCH] fixing issue #88 https://github.com/goburrow/modbus/issues/88 --- rtuclient.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtuclient.go b/rtuclient.go index ad6a31a..0b7b4e0 100644 --- a/rtuclient.go +++ b/rtuclient.go @@ -111,6 +111,9 @@ type rtuSerialTransporter struct { } func (mb *rtuSerialTransporter) Send(aduRequest []byte) (aduResponse []byte, err error) { + mb.mu.Lock() + defer mb.mu.Unlock() + // Make sure port is connected if err = mb.serialPort.connect(); err != nil { return