mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2026-06-18 14:41:04 +00:00
Fix malformed UPnP lease duration
This commit is contained in:
+2
-2
@@ -25,7 +25,6 @@
|
|||||||
#include <natpmp.h>
|
#include <natpmp.h>
|
||||||
|
|
||||||
#define NL "\n"
|
#define NL "\n"
|
||||||
#define STR(x) #x
|
|
||||||
|
|
||||||
#define SERVICE_NAME "MISS"
|
#define SERVICE_NAME "MISS"
|
||||||
#define UPNP_SERVICE_NAME "Moonlight"
|
#define UPNP_SERVICE_NAME "Moonlight"
|
||||||
@@ -149,10 +148,11 @@ bool UPnPMapPort(struct UPNPUrls* urls, struct IGDdatas* data, int proto, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create or update the expiration time of an existing mapping
|
// Create or update the expiration time of an existing mapping
|
||||||
|
snprintf(leaseDuration, sizeof(leaseDuration), "%d", PORT_MAPPING_DURATION_SEC);
|
||||||
printf("Updating UPnP port mapping for %s %s -> %s...", protoStr, portStr, myAddr);
|
printf("Updating UPnP port mapping for %s %s -> %s...", protoStr, portStr, myAddr);
|
||||||
err = UPNP_AddPortMapping(
|
err = UPNP_AddPortMapping(
|
||||||
urls->controlURL, data->first.servicetype, portStr,
|
urls->controlURL, data->first.servicetype, portStr,
|
||||||
portStr, myAddr, myDesc, protoStr, nullptr, STR(PORT_MAPPING_DURATION_SEC));
|
portStr, myAddr, myDesc, protoStr, nullptr, leaseDuration);
|
||||||
if (err == 725) { // OnlyPermanentLeasesSupported
|
if (err == 725) { // OnlyPermanentLeasesSupported
|
||||||
err = UPNP_AddPortMapping(
|
err = UPNP_AddPortMapping(
|
||||||
urls->controlURL, data->first.servicetype, portStr,
|
urls->controlURL, data->first.servicetype, portStr,
|
||||||
|
|||||||
Reference in New Issue
Block a user