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

Network wait API support #264

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

RishabhSaini
Copy link
Contributor

Resolves #259

handle.h: added option for LRO_NETWORK_WAIT and a helper function for handling netowork wait
handle.c: Added callback function required for GMainEventLoop and functionality for option
handle-py.c: Added the case for LRO_NETWORK_WAIT

Adds API support for waiting on network:
This waits for clients network interfaces till the specified time.
lr_handle_setopt(priv->repo_handle, error, LRO_NETWORK_WAIT, seconds)
This parses metalinkurl/baseurl and polls g_network_monitor_can_reach() in an event driven
manner with the help of GMainEventLoop.

librepo/CMakeLists.txt Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
@RishabhSaini RishabhSaini requested review from m-blaha and cgwalters and removed request for m-blaha and cgwalters September 6, 2022 12:42
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Show resolved Hide resolved
@RishabhSaini
Copy link
Contributor Author

Updated.
I have attempted to resolve the availability of nework control. Kindly review the changes.

Copy link
Contributor

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is looking pretty good to me.

There's still more to do, but I wouldn't think of these things as strictly blocking:

  • The code style/indentation does not match the rest of the project. librepo seems to use 4 space indents, and spaces between identifier and parenthesis.
  • I think to handle cancellation, we actually need to g_signal_connect (cancellable, "cancelled", ...) and break out of the mainloop too
  • Probably useful to think about what tests could look like for this - unit testing here is inherently hard and needs system integration testing

Now I do not have merge rights on this repository.

librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
librepo/handle.c Outdated Show resolved Hide resolved
handle.h: function signature for lr_handle_network_wait
handle.c: Added callback function required for GMainEventLoop

Adds API support for waiting on network in an event driven manner:
This waits for clients network interfaces till the specified time.
lr_handle_network_wait(priv->repo_handle, error, timeout_seconds)
This parses metalinkurl/baseurl and upon network-available signal,
it polls g_network_monitor_can_reach() with the help of
GMainEventLoop.
@RishabhSaini
Copy link
Contributor Author

@m-blaha Friendly Ping: Hey, when do you think this can be merged by

@m-blaha m-blaha self-assigned this Oct 13, 2022
Copy link
Member

@m-blaha m-blaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry for delay, the PR somehow dropped off my radar...
Thanks for your work! Just small comment - would it be possible (as a follow-up PR) to add this API also to python bindings?

@m-blaha m-blaha merged commit 5dec492 into rpm-software-management:master Oct 14, 2022
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.

Add API/support for waiting on network
3 participants