-
Notifications
You must be signed in to change notification settings - Fork 947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server/asyncio.py change in the _log_exception method to correct the logging when disconnecting the socket #1135
Conversation
cf #1110 (comment) this removes the error, when running a TCP server forwarding a serial server : ``` 17:10:21 ERROR mixin:113 Please do not use unit=, convert to slave=. ````
ReadRegistersRequestBase cf ResponseBase
in the _log_exception method : - all logging should be debug and not error - no logging should be thrown if the handler is not running, otherwise cancellation messages are duplicated, we see the first cancellation message at the closing stage and the same is shown when we enter the closed state this answers to #1110 (reply in thread)
pymodbus/server/async_io.py
Outdated
@@ -100,11 +100,13 @@ def __init__(self, owner): | |||
|
|||
def _log_exception(self): | |||
"""Show log exception.""" | |||
if not self.running: | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log exception can occur before and especially after server is running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _log_exception() is only called twice, in handle() when self.running is True and in connection_lost(), so always after server is running. But maybe i missunderstand something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_log_exception can be called from anywhere, we add/remove _log_exception often. Apart from that it is not logical nor correct that _log_exception depends on the state of the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
in the _log_exception method :
this answers to #1110 (reply in thread)