Skip to content

Commit

Permalink
Add trace to server.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Jan 23, 2025
1 parent 1e2fac5 commit f1e5a2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion pymodbus/server/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ def __init__( # pylint: disable=too-many-arguments

def callback_new_connection(self):
"""Handle incoming connect."""
return ServerRequestHandler(self)
return ServerRequestHandler(
self,
self.trace_packet,
self.trace_pdu,
self.trace_connect
)

async def shutdown(self):
"""Close server."""
Expand Down
8 changes: 4 additions & 4 deletions pymodbus/server/requesthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class ServerRequestHandler(TransactionManager):
"""Handle client connection."""

def __init__(self, owner):
def __init__(self, owner, trace_packet, trace_pdu, trace_connect):
"""Initialize."""
params = CommParams(
comm_name="server",
Expand All @@ -34,9 +34,9 @@ def __init__(self, owner):
self.framer,
0,
True,
None,
None,
None,
trace_packet,
trace_pdu,
trace_connect,
)

def callback_new_connection(self) -> ModbusProtocol:
Expand Down

0 comments on commit f1e5a2d

Please sign in to comment.