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

Gracefully handle no network connection during startup #34

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

siku2
Copy link
Contributor

@siku2 siku2 commented Jan 31, 2020

This is currently a draft because it has merge conflicts with both of the other PRs.
Since this is the easiest one to resolve I would like to wait for the others to be merged before fixing the conflicts here.

Fixes #13 by catching the error during startup and displaying a notification informing the user.

Additionally it also handles the following cases:

  • Connected during start of the SSDP server but not when shutting down causes the same socket error to be raised. Now it's just a warning.
  • Shutting down after if the server didn't connect would cause an error during shutdown because the server attribute is never set. This is now handled.

@siku2
Copy link
Contributor Author

siku2 commented Jan 31, 2020

It might be worth considering adding a retry loop to continuously (maybe with exponential back-off) try to connect until it succeeds.
What do you think, @enen92?

@enen92
Copy link
Owner

enen92 commented Jan 31, 2020

I am not sure network changes in kodi are propagated via the onNotification monitor interface. Probably this is something that could be looked at/tested to avoid blindingly scheduling a retry

# Conflicts:
#	resources/lib/service.py
#	resources/lib/tubecast/ssdp.py
@siku2
Copy link
Contributor Author

siku2 commented Jan 31, 2020

I reconnected to the internet while logging all onNotification calls and I didn't see any notifications related to the network.

Maybe the System.HasNetwork condition would work though?


Edit: In my case System.HasNetwork is true regardless of whether Kodi is connected to the internet. The condition seems to be for something else entirely.

@enen92
Copy link
Owner

enen92 commented Jan 31, 2020

That would require polling on the add-on side

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.

Script error if there isn't a network connection
2 participants