Sort using mac address because at the time of sorting socket names are not known yet.
This commit is contained in:
parent
4acb55c2e6
commit
4e89c2a6c7
|
@ -157,7 +157,7 @@ void Server::readPendingDatagrams()
|
||||||
if (!duplicate) {
|
if (!duplicate) {
|
||||||
Socket *socket = new Socket(sender, reply);
|
Socket *socket = new Socket(sender, reply);
|
||||||
sockets->push_back(socket);
|
sockets->push_back(socket);
|
||||||
std::sort(sockets->begin(), sockets->end(), [](const Socket* a, const Socket* b) -> bool { return QString(a->socketName) < QString(b->socketName); });
|
std::sort(sockets->begin(), sockets->end(), [](const Socket* a, const Socket* b) -> bool { return QString::compare(QString(a->mac), QString(b->mac)) < 0 ? true : false; }); // socket name is not known yet
|
||||||
Q_EMIT discovered();
|
Q_EMIT discovered();
|
||||||
}
|
}
|
||||||
mac = reply.mid(7, 6);
|
mac = reply.mid(7, 6);
|
||||||
|
|
Loading…
Reference in New Issue