Sort using mac address because at the time of sorting socket names are not known yet.

This commit is contained in:
Andrius Štikonas 2015-11-15 02:50:39 +00:00
parent 4acb55c2e6
commit 4e89c2a6c7
1 changed files with 1 additions and 1 deletions

View File

@ -157,7 +157,7 @@ void Server::readPendingDatagrams()
if (!duplicate) {
Socket *socket = new Socket(sender, reply);
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();
}
mac = reply.mid(7, 6);