mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-28 11:42:25 -04:00
Websocket spectrum: decode special addresses when setting from string
This commit is contained in:
parent
05d878fa82
commit
07be58b0fb
@ -90,6 +90,17 @@ void WSSpectrum::getPeers(QList<QHostAddress>& hosts, QList<quint16>& ports) con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WSSpectrum::setListeningAddress(const QString& address)
|
||||||
|
{
|
||||||
|
if (address == "127.0.0.1") {
|
||||||
|
m_listeningAddress.setAddress(QHostAddress::LocalHost);
|
||||||
|
} else if (address == "0.0.0.0") {
|
||||||
|
m_listeningAddress.setAddress(QHostAddress::Any);
|
||||||
|
} else {
|
||||||
|
m_listeningAddress.setAddress(address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString WSSpectrum::getWebSocketIdentifier(QWebSocket *peer)
|
QString WSSpectrum::getWebSocketIdentifier(QWebSocket *peer)
|
||||||
{
|
{
|
||||||
return QStringLiteral("%1:%2").arg(peer->peerAddress().toString(), QString::number(peer->peerPort()));
|
return QStringLiteral("%1:%2").arg(peer->peerAddress().toString(), QString::number(peer->peerPort()));
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
void closeSocket();
|
void closeSocket();
|
||||||
bool socketOpened() const;
|
bool socketOpened() const;
|
||||||
void getPeers(QList<QHostAddress>& hosts, QList<quint16>& ports) const;
|
void getPeers(QList<QHostAddress>& hosts, QList<quint16>& ports) const;
|
||||||
void setListeningAddress(const QString& address) { m_listeningAddress.setAddress(address); }
|
void setListeningAddress(const QString& address);
|
||||||
void setPort(quint16 port) { m_port = port; }
|
void setPort(quint16 port) { m_port = port; }
|
||||||
QHostAddress getListeningAddress() const;
|
QHostAddress getListeningAddress() const;
|
||||||
uint16_t getListeningPort() const;
|
uint16_t getListeningPort() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user