Skip to content

Comments

recv_internal: timeout=None means block forever#5

Merged
lukehugh merged 1 commit intoBIRLab:mainfrom
BenGardiner:fix-timeout-none-recv-block
Feb 24, 2026
Merged

recv_internal: timeout=None means block forever#5
lukehugh merged 1 commit intoBIRLab:mainfrom
BenGardiner:fix-timeout-none-recv-block

Conversation

@BenGardiner
Copy link
Contributor

based on discussion here hardbyte/python-can#2026 I think this is a valid change.

I've tested it here on a 500kbps medium-load bus....

@lukehugh
Copy link
Member

@BenGardiner Thank you very much. In fact, this interface references the implementation of gs_usb. As you pointed out in hardbyte/python-can#2026, the code in gs_usb treats None as non-blocking. If this is incorrect, then when hardbyte/python-can#2026 is merged, this patch will also be merged.

Besides, our implementation only supports timeouts up to 2^32-1 milliseconds (approximately 49 days). If None represents forever, perhaps we need to provide an elegant function at the C API level to achieve this?

@BenGardiner BenGardiner force-pushed the fix-timeout-none-recv-block branch from 965f4dc to 2940fb6 Compare February 23, 2026 15:24
@BenGardiner
Copy link
Contributor Author

I've update the magic constant to 2**32-1

I think 49d is close enough to forever for this. But yes the 100% correct fix would be to block indefitnitely I think.

Please see hardbyte/python-can#2031 where I have proposed the in-tree gs_usb fix. watch there to see if that is merged

Although: I never use the gs_usb driver anymore : now I use python-can-candle almost exclusively ♥

@lukehugh lukehugh merged commit 9e3e7ba into BIRLab:main Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants