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()
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);

6
src/base/net/portforwarder.h

@ -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;
}; };

2
src/webui/webui.h

@ -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

Loading…
Cancel
Save