-
Notifications
You must be signed in to change notification settings - Fork 73
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
Added default timeout on connection.receive() #257
Added default timeout on connection.receive() #257
Conversation
…nst server that died after connecting.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #257 +/- ##
=======================================
Coverage 99.06% 99.06%
=======================================
Files 24 24
Lines 5112 5112
=======================================
Hits 5064 5064
Misses 48 48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Sorry it's getting to the holiday season so I haven't been able to get to this. An initial impression gives me conerns around changing the default value here as I know some tools rely on it waiting indefinitely for a response, say a pipe read. It'll require some closer investigation to see what the best way forward for this is. |
Perhaps an alternative option would be to pass an (optional) timeout value with the disconnect and other high-level interface functions? That way, the app only hangs when the user wishes it to do so. |
I think at least making sure |
Hi! |
src/smbprotocol/connection.py
Outdated
@@ -989,7 +989,7 @@ def send_compound(self, messages, sid, tid, related=False): | |||
""" | |||
return self._send(messages, session_id=sid, tree_id=tid, related=related) | |||
|
|||
def receive(self, request, wait=True, timeout=None, resolve_symlinks=True): | |||
def receive(self, request, wait=True, timeout=60, resolve_symlinks=True): |
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.
Did you intend to leave this as 60
and not None
as the default?
Ah, I forgot to change that one back. My apologies, now the default of receive() should be as it originally was. |
Thanks for working on this, sorry for the delay in the original review. |
The library hang when following these steps:
Now the library hangs.
This is because of the connection.receive() function is called against a dead server, without a timeout.
This pull request suggests setting the default timeout of the connection.receive() function to the same value as the default timeout of the other functions.