• Sébastien Blin's avatar
    upnp: asynchronous open/close ports · 2d909770
    Sébastien Blin authored
    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
    2d909770
fetch_all.bat 1.67 KB