Browse Source

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

master
Andrius Štikonas 4 years ago
parent
commit
4e89c2a6c7
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      server.cpp

+ 1
- 1
server.cpp 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);

Loading…
Cancel
Save