Skip to content
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

Allow non-blocking reading of digests (with timeout=0) #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Trigary
Copy link
Contributor

@Trigary Trigary commented Sep 11, 2024

This change lets us call SimpleSwitchP4RuntimeAPI.get_digest_list with very low timeout values, e.g. timeout=0. Currently, a low timeout results in no digest being read (because the timeout is instantly over). With this fix, the timeout is not taken into account if no waiting is necessary because a digest is already available (because a digest has already been received previously).

Motivation: I want to be able to read a digest from one of the switches in the network. If the digest reading is a blocking operation, then it takes a considerable amount of time to iterate over all switches. This simple patch allows users to use digest reading as a non blocking operation, without having to use sockets or select.select directly.

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.

1 participant