-
Notifications
You must be signed in to change notification settings - Fork 666
Comments
interfaces/cantact: Handle None timeout by setting to 0#2026
Open
BenGardiner wants to merge 1 commit intohardbyte:main from
Open
interfaces/cantact: Handle None timeout by setting to 0 #2026BenGardiner wants to merge 1 commit intohardbyte:main from
BenGardiner wants to merge 1 commit intohardbyte:main from
Conversation
There are definitely cases of client code that end up passing timeout=None to _recv_internal(). Several other interfaces/*.py are prepared for this e.g. canalystii usb2can canlib_vcinpl2 gs_usb.py For cantact I think the right thing to do is set default timeout to 0 if None is provided.
Collaborator
zariiii9003
commented
Feb 7, 2026
But None means it should block indefinitely until a message is received.
The cantact lib calls recv_timeout(std::time::Duration::from_millis(timeout_ms) under the hood. I think it would be better to set timeout to a very large number (2**64 - 1) instead of 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
There are definitely cases of client code that end up passing timeout=None to _recv_internal(). Several other interfaces/*.py are prepared for this e.g. canalystii usb2can canlib_vcinpl2 gs_usb.py
For cantact I think the right thing to do is set default timeout to 0 if None is provided.
There are definitely cases of client code that end up passing timeout=None to _recv_internal(). Several other interfaces/*.py are prepared for this e.g. canalystii usb2can canlib_vcinpl2 gs_usb.py
For cantact I think the right thing to do is set default timeout to 0 if None is provided.
Type of Change
Checklist
tox).