Browse Source

fix webui port overflow

adaptive-webui-19844
thalieht 8 years ago
parent
commit
6ec1c61b06
  1. 6
      src/base/net/portforwarder.cpp
  2. 6
      src/base/net/portforwarder.h
  3. 2
      src/webui/webui.h

6
src/base/net/portforwarder.cpp

@ -70,7 +70,7 @@ PortForwarder *PortForwarder::instance() @@ -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);
@ -79,7 +79,7 @@ void PortForwarder::addPort(qint16 port) @@ -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)
@ -104,7 +104,7 @@ void PortForwarder::start() @@ -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);

6
src/base/net/portforwarder.h

@ -49,8 +49,8 @@ namespace Net @@ -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();
@ -64,7 +64,7 @@ namespace Net @@ -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;
};

2
src/webui/webui.h

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

Loading…
Cancel
Save