Fix UPNP code sample using OK constant incorrectly
The returned value is an UPNPResult, not an Error. Both `UPNP.UPNP_RESULT_SUCCESS` and `OK` are equal to 0, so it will behave the same, but it's not identical from a static typing perspective.
This commit is contained in:
parent
77579f93e6
commit
cfa8d762ef
1 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@
|
|||
var upnp = UPNP.new()
|
||||
var err = upnp.discover()
|
||||
|
||||
if err != OK:
|
||||
if err != UPNP.UPNP_RESULT_SUCCESS:
|
||||
push_error(str(err))
|
||||
upnp_completed.emit(err)
|
||||
return
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
if upnp.get_gateway() and upnp.get_gateway().is_valid_gateway():
|
||||
upnp.add_port_mapping(server_port, server_port, ProjectSettings.get_setting("application/config/name"), "UDP")
|
||||
upnp.add_port_mapping(server_port, server_port, ProjectSettings.get_setting("application/config/name"), "TCP")
|
||||
upnp_completed.emit(OK)
|
||||
upnp_completed.emit(UPNP.UPNP_RESULT_SUCCESS)
|
||||
|
||||
func _ready():
|
||||
thread = Thread.new()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue