Skip to content
Snippets Groups Projects
Commit 2d909770 authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk
Browse files

upnp: asynchronous open/close ports

The UPnP stack now opens and closes ports with an
asynchronous mechanic and with callbacks.

Every time a mapping request (open or close) is sent,
a callback is registered and managed by the context.
When the corresponding protocol executes the request and
gets an answer, the right callback is found and dispatched
to its controller. A timeout of 1 second is implemented
on each request.

Controllers can now be tracked with a unique Id (a string
that represents its location in memory).

The IGD class now tracks its current active ports and
manages the number of users for each port.

The PMPIGD class now operates using a queue of mapping
requests. Whenever a request is made to the natpmp protocol,
it saves the request to its corresponding list (mapToAdd,
mapToRemove or mapToRenew in the PMPIGD class) and notifies
the main natpmp thread. The thread then checks if there
is any pending map requests in the PMPIGD queue and treats
them accordingly.

Add Nat-Pmp support for windows.

Fixed bug where nat-pmp wouldn't find an IGD on a new interface
after a connectivity change. The problem stems from the fact
that, for one, the nat-pmp handle didn't get cleared internally
once a connectivity change occured. This would cause the nat-
pmp library to try and send searches on a socket that was
bound on the old gateway. Secondly, if you don't wait for a
little period of time, the natpmp library would discover the
old IGD on the old interface before the connectivity change
modifications were completed. Now we restart the nat-pmp
process one second after the connectivity change triggers.

Change-Id: I39a9b57e237deaa65eef4464a1838eaa3c5bbb03
parent dca8e056
No related branches found
No related tags found
No related merge requests found
Showing
with 655 additions and 214 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment