mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-18 01:51:39 +00:00
Fix UPnP port mapping not working
Despite UPNP_AddPortMapping returning sucess status, no port mapping would actually be added at all. And that's due to a memset call in the middle of the function. Wiping the IGDdatas struct, moving the memset to the start of the function fixes it and a port mapping is actually created/removed when a server is started/stopped.
This commit is contained in:
parent
a5bf4a5b8f
commit
8962355d6c
1 changed files with 4 additions and 2 deletions
|
@ -300,6 +300,10 @@ init_upnpc_once(struct upnpdata *upnpuserdata)
|
||||||
int upnp_error = -2;
|
int upnp_error = -2;
|
||||||
int scope_id = 0;
|
int scope_id = 0;
|
||||||
int status_code = 0;
|
int status_code = 0;
|
||||||
|
|
||||||
|
memset(&urls, 0, sizeof(struct UPNPUrls));
|
||||||
|
memset(&data, 0, sizeof(struct IGDdatas));
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Looking for UPnP Internet Gateway Device\n"));
|
CONS_Printf(M_GetText("Looking for UPnP Internet Gateway Device\n"));
|
||||||
devlist = upnpDiscoverDevices(deviceTypes, 500, NULL, NULL, 0, false, 2, &upnp_error, 0);
|
devlist = upnpDiscoverDevices(deviceTypes, 500, NULL, NULL, 0, false, 2, &upnp_error, 0);
|
||||||
if (devlist)
|
if (devlist)
|
||||||
|
@ -327,8 +331,6 @@ init_upnpc_once(struct upnpdata *upnpuserdata)
|
||||||
parserootdesc(descXML, descXMLsize, &data);
|
parserootdesc(descXML, descXMLsize, &data);
|
||||||
free(descXML);
|
free(descXML);
|
||||||
descXML = NULL;
|
descXML = NULL;
|
||||||
memset(&urls, 0, sizeof(struct UPNPUrls));
|
|
||||||
memset(&data, 0, sizeof(struct IGDdatas));
|
|
||||||
GetUPNPUrls(&urls, &data, dev->descURL, status_code);
|
GetUPNPUrls(&urls, &data, dev->descURL, status_code);
|
||||||
I_AddExitFunc(I_ShutdownUPnP);
|
I_AddExitFunc(I_ShutdownUPnP);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue