Skip to content

amuleweb: -U / --upnp-port is registered as a switch and cannot accept a port value #816

Description

@ngosang

In src/webserver/src/WebInterface.cpp, the --upnp-port command-line argument is registered as a switch (a flag that takes no value):

// WebInterface.cpp:248
amuleweb_parser.AddSwitch("U", "upnp-port",
    _("UPnP port"),
    wxCMD_LINE_PARAM_OPTIONAL);

But OnCmdLineParsed later tries to read a numeric value from it:

// WebInterface.cpp:352
if (parser.Found("upnp-port", &port)) {
    m_UPnPTCPPort = port;
}

A switch never carries a value, so -U / --upnp-port can never actually set the UPnP TCP port from the command line — the UPnPTCPPort setting can only be changed by editing remote.conf directly.

For comparison, --server-port is correctly declared as an option:

// WebInterface.cpp:240
amuleweb_parser.AddOption("s", "server-port",
    _("Web server HTTP port"),
    wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);

Expected: --upnp-port should be declared with AddOption(..., wxCMD_LINE_VAL_NUMBER, ...) so it accepts a port number, matching --server-port.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions