Merge pull request #5731 from thalieht/webui_port

Fix WEBUI port overflow
This commit is contained in:
sledgehammer999 2016-09-13 23:54:01 +03:00 committed by GitHub
commit 3ea81be2cc
3 changed files with 7 additions and 7 deletions

View File

@ -70,7 +70,7 @@ PortForwarder *PortForwarder::instance()
return m_instance; return m_instance;
} }
void PortForwarder::addPort(qint16 port) void PortForwarder::addPort(quint16 port)
{ {
if (!m_mappedPorts.contains(port)) { if (!m_mappedPorts.contains(port)) {
m_mappedPorts.insert(port, 0); m_mappedPorts.insert(port, 0);
@ -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_mappedPorts.contains(port)) {
if (m_active) if (m_active)
@ -104,7 +104,7 @@ void PortForwarder::start()
qDebug("Enabling UPnP / NAT-PMP"); qDebug("Enabling UPnP / NAT-PMP");
m_provider->start_upnp(); m_provider->start_upnp();
m_provider->start_natpmp(); 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_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
m_active = true; m_active = true;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [ON]"), Log::INFO); Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [ON]"), Log::INFO);

View File

@ -49,8 +49,8 @@ namespace Net
static void freeInstance(); static void freeInstance();
static PortForwarder *instance(); static PortForwarder *instance();
void addPort(qint16 port); void addPort(quint16 port);
void deletePort(qint16 port); void deletePort(quint16 port);
private slots: private slots:
void configure(); void configure();
@ -64,7 +64,7 @@ namespace Net
bool m_active; bool m_active;
libtorrent::session *m_provider; libtorrent::session *m_provider;
QHash<qint16, int> m_mappedPorts; QHash<quint16, int> m_mappedPorts;
static PortForwarder *m_instance; static PortForwarder *m_instance;
}; };

View File

@ -58,7 +58,7 @@ private:
QPointer<Http::Server> httpServer_; QPointer<Http::Server> httpServer_;
QPointer<Net::DNSUpdater> dynDNSUpdater_; QPointer<Net::DNSUpdater> dynDNSUpdater_;
QPointer<AbstractWebApplication> webapp_; QPointer<AbstractWebApplication> webapp_;
qint16 m_port; quint16 m_port;
}; };
#endif // WEBUI_H #endif // WEBUI_H