diff --git a/pymodbus/client/base.py b/pymodbus/client/base.py index 4ba1f0c31..75d6c0878 100644 --- a/pymodbus/client/base.py +++ b/pymodbus/client/base.py @@ -189,7 +189,6 @@ async def async_execute(self, request=None): """Execute requests asynchronously.""" request.transaction_id = self.transaction.getNextTID() packet = self.framer.buildPacket(request) - Log.debug("send: {}", packet, ":hex") self.transport_send(packet) req = self._build_response(request.transaction_id) if self.params.broadcast_enable and not request.slave_id: @@ -217,7 +216,6 @@ def callback_data(self, data: bytes, addr: tuple = None) -> int: returns number of bytes consumed """ - Log.debug("recv: {} addr={}", data, ":hex", addr) self.framer.processIncomingPacket(data, self._handle_response, slave=0) return len(data) diff --git a/pymodbus/transport/transport.py b/pymodbus/transport/transport.py index 0ac3e8445..85feda32b 100644 --- a/pymodbus/transport/transport.py +++ b/pymodbus/transport/transport.py @@ -282,20 +282,15 @@ def data_received(self, data: bytes): :param data: non-empty bytes object with incoming data. """ - Log.debug("recv: {}", data, ":hex") - if self.comm_params.handle_local_echo and self.sent_buffer == data: - self.sent_buffer = b"" - return - self.recv_buffer += data - cut = self.callback_data(self.recv_buffer) - self.recv_buffer = self.recv_buffer[cut:] + self.datagram_received(data, None) def datagram_received(self, data: bytes, addr: tuple): """Receive datagram (UDP connections).""" - Log.debug("recv: {} addr={}", data, ":hex", addr) if self.comm_params.handle_local_echo and self.sent_buffer == data: + Log.debug("recv skipping (local_echo): {} addr={}", data, ":hex", addr) self.sent_buffer = b"" return + Log.debug("recv: {} addr={}", data, ":hex", addr) self.recv_buffer += data cut = self.callback_data(self.recv_buffer, addr=addr) self.recv_buffer = self.recv_buffer[cut:]