Godot: UPNP.add_port_mapping() outputs error regarding delete_port_mapping()

Created on 23 Apr 2020  ·  1Comment  ·  Source: godotengine/godot

Godot version:
3.2.1 stable

OS/device including version:
Windows 10
The router I use is a Orange Livebox, I'm not sure what parts of the description .xml might be useful and safe to share. Also I don't have admin access to it.

Issue description:
Adding a port mapping outputs an error regarding delete_port_mapping. The port mapping seems to get properly added and can be deleted later with no error.
Issue described in this question https://godotengine.org/qa/65365/delete_port_mapping-condition-i-0-is-true
Outputs E 0:00:03.211 delete_port_mapping: Condition "i != (0)" is true. Returned: UPNP::upnp_result(i) <C++ Source> modules/upnp/upnp_device.cpp:90 @ delete_port_mapping() <Stack Trace> UPNPTest.gd:8 @ _ready()

Steps to reproduce:
Run the following:
var upnp = UPNP.new()
upnp.discover()
upnp.add_port_mapping(4200)
Minimal reproduction project:
upnp bug repro.zip

bug network

Most helpful comment

This is a pretty annoying bug that is also happening in my project.

EDIT: If anyone has this same bug and finds this issue, you can bypass the error by adding the port mapping directly to the default gateway, which is the same thing upnp.add_port_mapping does, minus trying to delete a non existing port.

upnp = UPNP.new()
var result = upnp.discover()
if result == UPNP.UPNP_RESULT_SUCCESS:
    var gateway = upnp.get_gateway()
    gateway.add_port_mapping(4200)

>All comments

This is a pretty annoying bug that is also happening in my project.

EDIT: If anyone has this same bug and finds this issue, you can bypass the error by adding the port mapping directly to the default gateway, which is the same thing upnp.add_port_mapping does, minus trying to delete a non existing port.

upnp = UPNP.new()
var result = upnp.discover()
if result == UPNP.UPNP_RESULT_SUCCESS:
    var gateway = upnp.get_gateway()
    gateway.add_port_mapping(4200)

Was this page helpful?
0 / 5 - 0 ratings