Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

UPnP leases issue #3298

Merged
merged 9 commits into from
May 25, 2021
Merged

UPnP leases issue #3298

merged 9 commits into from
May 25, 2021

Conversation

thsfs
Copy link
Contributor

@thsfs thsfs commented May 20, 2021

This PR is intended to address the proposed changes on #3295 proposed by https://github.com/sudokai0

  1. changed check_mapping() name to check_lost_or_old_mapping(), so it reflects better what it does;
  2. changed call to the refresh_mapping() in the end of the lease time to call its parent loop instead of itself;
  3. inverted the return logic so it returns true only if there is a protocol that evaluates to an error or old leasing time. In check_lost_or_old_mapping() there is a loop over the protocols and the former implementation was setting the return to false for the first protocol found ok, preventing others (in case there were any other) to get updated;
  4. fixed the logic for calling refresh_mapping().

@thsfs thsfs changed the title Upnp leases issue (#3295) UPnP leases issue (#3295) May 20, 2021
@thsfs thsfs changed the title UPnP leases issue (#3295) Upnp leases issue May 20, 2021
@thsfs thsfs changed the title Upnp leases issue UPnP leases issue May 20, 2021
There is no need for the call to check_mapping_loop because there is
an outer check that will work every time as long as it tickets fast enough.
…check period

We currently check every health check period for renewals but every
5 minutes for devices. It is too complicated to have 2 different setting
and there is no need. It is harder to code, document and to understand
and there is not much benefit from it.

So, use health check period for all checks. Nice and simple.
The logging before didn't make it clear if it was remaining lease or
total lease time.
@thsfs thsfs requested review from SergiySW and theohax May 20, 2021 22:00
Some upnp logs are throttle controlled so that users are not swamped by
upnp messages, if upnp is not working.

However, when upnp logging is explicitly enabled then it makes no sense
to throttle them.
@thsfs thsfs merged commit 35a81f2 into develop May 25, 2021
@thsfs thsfs deleted the upnp_leases_issue branch May 25, 2021 16:18
clemahieu pushed a commit that referenced this pull request May 28, 2021
* Inverted logic for refreshing upnp port mapping

* Refresh logic for UPnP lease to consider more than one protocol

* mapping_protocol pretty print function to_string()

Preparatory change for better logging in portmapping

* Remove extraneous and needless call to check_mapping_loop

There is no need for the call to check_mapping_loop because there is
an outer check that will work every time as long as it tickets fast enough.

* Remove extraneous and needless logging

* Pretty print function for port_mapping and upnp_state classes

* Check for missing mappings, renewals or gateway changes every health check period

We currently check every health check period for renewals but every
5 minutes for devices. It is too complicated to have 2 different setting
and there is no need. It is harder to code, document and to understand
and there is not much benefit from it.

So, use health check period for all checks. Nice and simple.

* Improve logging regarding remaining upnp lease

The logging before didn't make it clear if it was remaining lease or
total lease time.

* Always print all upnp logs if unpn logging is enabled

Some upnp logs are throttle controlled so that users are not swamped by
upnp messages, if upnp is not working.

However, when upnp logging is explicitly enabled then it makes no sense
to throttle them.

Co-authored-by: Dimitrios Siganos <dimitris@siganos.org>
@clemahieu clemahieu added this to the V22.1 milestone Jun 3, 2021
@zhyatt zhyatt added the bug label Jul 16, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants