Skip to content

Commit

Permalink
Merge 3.6.7 back into dev. (#2156)
Browse files Browse the repository at this point in the history
* Add lock to async requests, correct logging and length calc.

* Prepare v3.6.7.

* Prepare v3.6.7.

* Correct change.log.

* prepare dev.

* Doc update.
  • Loading branch information
janiversen committed Apr 9, 2024
1 parent a6b43dd commit e8063fa
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 23 deletions.
3 changes: 3 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Thanks to
- dhoomakethu
- doelki
- DominicDataP
- Dominique Martinet
- Dries
- duc996
- Farzad Panahi
Expand All @@ -38,13 +39,15 @@ Thanks to
- Hangyu Fan
- Hayden Roche
- Iktek
- Ilkka Ollakka
- Jakob Ruhe
- Jakob Schlyter
- James Braza
- James Hilliard
- jan iversen
- Jerome Velociter
- Joe Burmeister
- John Miko
- Jonathan Reichelt Gjertsen
- julian
- Justin Standring
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ helps make pymodbus a better product.

:ref:`Authors`: contains a complete list of volunteers have contributed to each major version.

Version 3.6.7
-------------
* Add lock to async requests, correct logging and length calc. (FIX, not on dev)
* test_simulator: use unused_tcp_port fixture (#2141)
* streamline imports in Factory.py (#2140)
* Secure testing is done with pymodbus in PR. (#2136)
* Fix link to github in README (#2134)
* Wildcard exception catch from pyserial. (#2125)
* Problem with stale CI. (#2117)
* Add connection exception to list of exceptions catpured in retries (#2113)
* Move on_reconnect to client level (#2111)
* Bump github stale. (#2110)
* update package_test_tool (add 4 test scenarios) (#2107)
* Bump dependencies. (#2108)
* Cancel send if no connection. (#2103)


Version 3.6.6
-------------
* Solve transport close() as not inherited method. (#2098)
Expand Down
1 change: 0 additions & 1 deletion MAKE_RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Prepare/make release on dev.
update AUTHORS.rst and CHANGELOG.rst
cd doc; ./build_html
* rm -rf build/* dist/*
* git checkout build
* python3 -m build
* twine check dist/*
* Commit, push and merge.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PyModbus - A Python Modbus Stack

Pymodbus is a full Modbus protocol implementation offering client/server with synchronous/asynchronous API a well as simulators.

Current release is `3.6.6 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.6.6>`_.
Current release is `3.6.7 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.6.7>`_.

Bleeding edge (not released) is `dev <https://github.com/pymodbus-dev/pymodbus/tree/dev>`_.

Expand Down
14 changes: 14 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS = -W --keep-going

# Put it first so that "make" without argument is like "make help".
help:
sphinx-build -M help "." "_build" -W --keep-going

.PHONY: help Makefile

%: Makefile
sphinx-build -M $@ "." "_build" -W --keep-going
Binary file modified doc/source/_static/examples.tgz
Binary file not shown.
Binary file modified doc/source/_static/examples.zip
Binary file not shown.
9 changes: 4 additions & 5 deletions doc/source/library/architecture/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ The internal structure of pymodbus is a bit complicated, mostly due to the mixtu

The overall architecture can be viewed as:


Client classes (interface to applications)
mixin (interface with all requests defined as methods)
Lower levels are Common
transaction (handles transactions and allow concurrent calls)
framers (add pre/post headers to make a valid package)
transport (handles actual transportation)

Server classes (interface to applications)
datastores (handles registers/values to be returned)
Lower levels are Common

pdu (build/create response/request class)
transaction (handles transactions and allow concurrent calls)
framers (add pre/post headers to make a valid package)
transport (handles actual transportation)
Expand All @@ -27,3 +25,4 @@ In detail the packages can viewed as:
In detail the classes can be viewed as:

.. image:: classes.png

24 changes: 12 additions & 12 deletions doc/source/library/framer.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
Framer
======

pymodbus\.framer\.old_framer_ascii module
-----------------------------------------
pymodbus\.framer\.ModbusAsciiFramer module
------------------------------------------

.. automodule:: pymodbus.framer.old_framer_ascii
.. automodule:: pymodbus.framer.ModbusAsciiFramer
:members:
:undoc-members:
:show-inheritance:

pymodbus\.framer\.old_framer_rtu module
---------------------------------------
pymodbus\.framer\.ModbusRtuFramer module
----------------------------------------

.. automodule:: pymodbus.framer.old_framer_rtu
.. automodule:: pymodbus.framer.ModbusRtuFramer
:members:
:undoc-members:
:show-inheritance:

pymodbus\.framer\.old_framer_socket module
------------------------------------------
pymodbus\.framer\.ModbusSocketFramer module
-------------------------------------------

.. automodule:: pymodbus.framer.old_framer_socket
.. automodule:: pymodbus.framer.ModbusSocketFramer
:members:
:undoc-members:
:show-inheritance:

pymodbus\.framer\.old_framer_tls module
---------------------------------------
pymodbus\.framer\.ModbusTlsFramer module
----------------------------------------

.. automodule:: pymodbus.framer.old_framer_tls
.. automodule:: pymodbus.framer.ModbusTlsFramer
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion pymodbus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
from pymodbus.pdu import ExceptionResponse


__version__ = "3.7.0dev"
__version__ = "3.7.0dev1"
__version_full__ = f"[pymodbus, version {__version__}]"
2 changes: 2 additions & 0 deletions pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def __init__(
self.state = ModbusTransactionState.IDLE
self.last_frame_end: float | None = 0
self.silent_interval: float = 0
self._lock = asyncio.Lock()

# ----------------------------------------------------------------------- #
# Client external interface
Expand Down Expand Up @@ -165,6 +166,7 @@ async def async_execute(self, request) -> ModbusResponse:
while count <= self.retries:
req = self.build_response(request.transaction_id)
if not count or not self.no_resend_on_retry:
self.ctx.framer.resetFrame()
self.ctx.send(packet)
if self.broadcast_enable and not request.slave_id:
resp = None
Expand Down
1 change: 1 addition & 0 deletions pymodbus/client/modbusclientprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def callback_connected(self) -> None:
"""Call when connection is succcesfull."""
if self.on_connect_callback:
self.loop.call_soon(self.on_connect_callback, True)
self.framer.resetFrame()

def callback_disconnected(self, exc: Exception | None) -> None:
"""Call when connection is lost."""
Expand Down
9 changes: 6 additions & 3 deletions test/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ async def test_stub(self, use_port, use_cls):
client.close()
stub.close()

async def test_double_packet(self, use_port, use_cls):
async def test_parallel_requests(self, use_port, use_cls):
"""Test double packet on network."""
old_data = b''
client = AsyncModbusTcpClient(NULLMODEM_HOST, port=use_port, retries=0)
client = AsyncModbusTcpClient(NULLMODEM_HOST, port=use_port, retries=0, timeout=30)

def local_handle_data(data: bytes) -> bytes | None:
"""Handle server side for this test case."""
Expand Down Expand Up @@ -126,6 +126,9 @@ async def local_call(addr: int) -> bool:
await stub.start_run()

assert await client.connect()
await asyncio.gather(*[local_call(x) for x in range(1, 10)])
try:
await asyncio.gather(*[local_call(1) for x in range(1, 10)])
except Exception as exc: # pylint: disable=broad-exception-caught
pytest.fail(exc)
client.close()
stub.close()

0 comments on commit e8063fa

Please sign in to comment.