Updated client id generation to use host ip rather than name
This commit is contained in:
parent
b28b174056
commit
63bf0029aa
1 changed files with 12 additions and 1 deletions
|
@ -1,7 +1,10 @@
|
||||||
|
#include <QDebug>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
#include <QHostInfo>
|
||||||
|
#include <QHostAddress>
|
||||||
#include "remoteclient.h"
|
#include "remoteclient.h"
|
||||||
#include "settingscache.h"
|
#include "settingscache.h"
|
||||||
#include "pending_command.h"
|
#include "pending_command.h"
|
||||||
|
@ -365,7 +368,15 @@ void RemoteClient::disconnectFromServer()
|
||||||
QString RemoteClient::getSrvClientID(const QString _hostname)
|
QString RemoteClient::getSrvClientID(const QString _hostname)
|
||||||
{
|
{
|
||||||
QString srvClientID = settingsCache->getClientID();
|
QString srvClientID = settingsCache->getClientID();
|
||||||
|
QHostInfo hostInfo = QHostInfo::fromName(_hostname);
|
||||||
|
if (!hostInfo.error()) {
|
||||||
|
QHostAddress hostAddress = hostInfo.addresses().first();
|
||||||
|
srvClientID += hostAddress.toString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug() << "Warning: ClientID generation host lookup failure [" << hostInfo.errorString() << "]";
|
||||||
srvClientID += _hostname;
|
srvClientID += _hostname;
|
||||||
|
}
|
||||||
QString uniqueServerClientID = QCryptographicHash::hash(srvClientID.toUtf8(), QCryptographicHash::Sha1).toHex().right(15);
|
QString uniqueServerClientID = QCryptographicHash::hash(srvClientID.toUtf8(), QCryptographicHash::Sha1).toHex().right(15);
|
||||||
return uniqueServerClientID;
|
return uniqueServerClientID;
|
||||||
}
|
}
|
Loading…
Reference in a new issue