Skip to content

Commit

Permalink
Merge pull request qbittorrent#5731 from thalieht/webui_port
Browse files Browse the repository at this point in the history
 Fix WEBUI port overflow
  • Loading branch information
sledgehammer999 committed Sep 13, 2016
2 parents a7253c5 + 6ec1c61 commit 3ea81be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/base/net/portforwarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ PortForwarder *PortForwarder::instance()
return m_instance;
}

void PortForwarder::addPort(qint16 port)
void PortForwarder::addPort(quint16 port)
{
if (!m_mappedPorts.contains(port)) {
m_mappedPorts.insert(port, 0);
Expand All @@ -79,7 +79,7 @@ void PortForwarder::addPort(qint16 port)
}
}

void PortForwarder::deletePort(qint16 port)
void PortForwarder::deletePort(quint16 port)
{
if (m_mappedPorts.contains(port)) {
if (m_active)
Expand All @@ -104,7 +104,7 @@ void PortForwarder::start()
qDebug("Enabling UPnP / NAT-PMP");
m_provider->start_upnp();
m_provider->start_natpmp();
foreach (qint16 port, m_mappedPorts.keys())
foreach (quint16 port, m_mappedPorts.keys())
m_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
m_active = true;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [ON]"), Log::INFO);
Expand Down
6 changes: 3 additions & 3 deletions src/base/net/portforwarder.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace Net
static void freeInstance();
static PortForwarder *instance();

void addPort(qint16 port);
void deletePort(qint16 port);
void addPort(quint16 port);
void deletePort(quint16 port);

private slots:
void configure();
Expand All @@ -64,7 +64,7 @@ namespace Net

bool m_active;
libtorrent::session *m_provider;
QHash<qint16, int> m_mappedPorts;
QHash<quint16, int> m_mappedPorts;

static PortForwarder *m_instance;
};
Expand Down
2 changes: 1 addition & 1 deletion src/webui/webui.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private slots:
QPointer<Http::Server> httpServer_;
QPointer<Net::DNSUpdater> dynDNSUpdater_;
QPointer<AbstractWebApplication> webapp_;
qint16 m_port;
quint16 m_port;
};

#endif // WEBUI_H

0 comments on commit 3ea81be

Please sign in to comment.