Skip to content

Commit 8d2634f

Browse files
authored
Remove unused callback in ServerRequestHandler (#2737)
1 parent 5d88994 commit 8d2634f

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

examples/package_test_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def callback_data(self, data: bytes, addr: tuple | None = None) -> int:
9090
return len(data)
9191

9292
def callback_connected(self) -> None:
93-
"""Call when connection is succcesfull."""
93+
"""Call when connection is successful."""
9494

9595
def callback_disconnected(self, exc: Exception | None) -> None:
9696
"""Call when connection is lost."""

pymodbus/server/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ async def serve_forever(self, *, background: bool = False):
8888
Log.info("Server graceful shutdown.")
8989

9090
def callback_connected(self) -> None:
91-
"""Call when connection is succcesfull."""
92-
raise RuntimeError("callback_new_connection should never be called")
91+
"""Call when connection is successful."""
92+
raise RuntimeError("callback_connected should never be called")
9393

9494
def callback_disconnected(self, exc: Exception | None) -> None:
9595
"""Call when connection is lost."""

pymodbus/server/requesthandler.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pymodbus.logging import Log
1010
from pymodbus.pdu.pdu import ExceptionResponse
1111
from pymodbus.transaction import TransactionManager
12-
from pymodbus.transport import CommParams, ModbusProtocol
12+
from pymodbus.transport import CommParams
1313

1414

1515
class ServerRequestHandler(TransactionManager):
@@ -40,10 +40,6 @@ def __init__(self, owner, trace_packet, trace_pdu, trace_connect):
4040
trace_connect,
4141
)
4242

43-
def callback_new_connection(self) -> ModbusProtocol:
44-
"""Call when listener receive new connection request."""
45-
raise RuntimeError("callback_new_connection should never be called")
46-
4743
def callback_disconnected(self, call_exc: Exception | None) -> None:
4844
"""Call when connection is lost."""
4945
super().callback_disconnected(call_exc)

pymodbus/transaction/transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def callback_new_connection(self):
214214
"""Call when listener receive new connection request."""
215215

216216
def callback_connected(self) -> None:
217-
"""Call when connection is succcesfull."""
217+
"""Call when connection is successful."""
218218
self.count_until_disconnect = self.max_until_disconnect
219219
self.next_tid = 0
220220
self.trace_connect(True)

pymodbus/transport/transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def callback_new_connection(self) -> ModbusProtocol:
361361

362362
@abstractmethod
363363
def callback_connected(self) -> None:
364-
"""Call when connection is succcesfull."""
364+
"""Call when connection is successful."""
365365

366366
@abstractmethod
367367
def callback_disconnected(self, exc: Exception | None) -> None:

test/transport/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def callback_new_connection(self) -> ModbusProtocol:
2222
return DummyProtocol(params=self.comm_params, is_server=False)
2323

2424
def callback_connected(self) -> None:
25-
"""Call when connection is succcesfull."""
25+
"""Call when connection is successful."""
2626

2727
def callback_disconnected(self, exc: Exception | None) -> None:
2828
"""Call when connection is lost."""

0 commit comments

Comments
 (0)