PUPnP keeps executing callbacks after UPnP context has been stopped
For some reason (not sure if this is intended behavior or a bug), libupnp sometimes keeps generating discovery events for the same IGDs every 50 seconds (forever, as far as I can tell -- I once let it ran for over 12 hours and it didn't stop). This is probably fine when UPnP is active, but we should make sure it stops when UPnP is deactivated. Concretely, this means that we need to call UpnpUnRegisterClient
when we stop the UPnP context. (We already call UpnpRegisterClient
when the UPnP context gets started.)
Added 2024-05-17: Our code treats UPNP_DISCOVERY_ADVERTISEMENT_ALIVE
and UPNP_DISCOVERY_SEARCH_RESULT
events the same way, so the repeated discovery events may simply be due to the IGD sending SSDP alive messages at regular intervals.
[1714149680.795|5336] Starting UPNP context
[1714149680.795|5336] PUPnP: Start search for IGD: attempt 1
[1714149680.798|5311|jamiaccount.cpp :1523] [Account f55a309b1db83073] UPnP: attempting to map ports
[1714149680.811|5311|jamiaccount.cpp :1541] [Account f55a309b1db83073] DHT UPNP mapping changed to JAMI-UDP:20949 (state=PENDING, auto-update=YES)
[1714149680.846|5336] PUPnP: Initialized on 192.168.50.147:0
[1714149680.846|5336] PUPnP: Successfully registered client
[1714149680.846|5336] PUPnP: Send IGD search request
[1714149680.847|5336] NAT-PMP: Read response on IGD 192.168.50.1 failed - NOGATEWAYSUPPORT
[1714149680.847|5336] UPNP/NAT-PMP enabled, but no valid IGDs available
[1714149690.846|5336] PUPnP: Start search for IGD: attempt 2
[1714149690.846|5336] PUPnP: Send IGD search request
[1714149690.848|5336] NAT-PMP: Read response on IGD 192.168.50.1 failed - NOGATEWAYSUPPORT
[1714149710.847|5336] PUPnP: Start search for IGD: attempt 3
[1714149710.847|5336] PUPnP: Send IGD search request
[1714149710.849|5336] NAT-PMP: Read response on IGD 192.168.50.1 failed - NOGATEWAYSUPPORT
[1714149717.887|5336] PUPnP: Discovered a new IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149717.888|5373] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149717.888|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.888|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.888|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.889|5336] PUPnP: Discovered a new IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149717.889|5363] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149717.889|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.890|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.890|5336] PUPnP: Discovered a new IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149717.890|5365] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149717.890|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.891|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.891|5336] PUPnP: Discovered a new IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149717.891|5367] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149717.891|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149717.892|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149722.892|5363] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149722.893|5373] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149722.895|5365] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149722.896|5367] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149725.788|5336] Stopping UPNP context
[1714149767.797|5336] PUPnP: Discovered a new IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149767.797|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.797|5371] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149767.797|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.798|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.798|5336] PUPnP: Discovered a new IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149767.798|5369] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149767.798|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.799|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.799|5336] PUPnP: Discovered a new IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149767.799|5373] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149767.799|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.800|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.800|5336] PUPnP: Discovered a new IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml]
[1714149767.800|5492] PUPnP: downLoadIgdDescription http://192.168.51.82:1780/InternetGatewayDevice.xml
[1714149767.801|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149767.801|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149772.802|5371] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149772.803|5369] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149772.804|5373] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149772.805|5492] PUPnP: Error downloading device XML document from http://192.168.51.82:1780/InternetGatewayDevice.xml -> UPNP_E_SOCKET_CONNECT
[1714149817.707|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.707|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.707|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.707|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.708|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.708|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.708|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.709|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.709|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.709|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.709|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.710|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149817.710|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.617|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.618|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.618|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.618|5336] PUPnP: IGD [uuid:C084EDD9-1DE4-9E6A-DEAD-34A8C7031F76 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.619|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.619|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.619|5336] PUPnP: IGD [uuid:0F2A137C-6FF1-C2BE-A962-0150A7DA9FA9 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.619|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.620|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.620|5336] PUPnP: IGD [uuid:64D4257E-8CFC-3924-97C1-9183CCBFEDB1 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.620|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.621|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[1714149867.621|5336] PUPnP: IGD [uuid:08780A31-017A-6198-F7A9-0B060FA1B336 url: http://192.168.51.82:1780/InternetGatewayDevice.xml] already in the list
[...]