mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
moved code logic to callling function & indent fix
This commit is contained in:
parent
8aa7a1d6be
commit
3c513b4bfc
2 changed files with 13 additions and 12 deletions
|
|
@ -380,16 +380,11 @@ QList<ServerProperties> Servatrice::getServerList() const
|
|||
int Servatrice::getUsersWithAddress(const QHostAddress &address) const
|
||||
{
|
||||
int result = 0;
|
||||
QString trustedSources = settingsCache->value("server/trusted_sources","127.0.0.1,::1").toString();
|
||||
|
||||
if (trustedSources.contains(address.toString(),Qt::CaseInsensitive)) {
|
||||
//allow all clients from trusted sources regardsless of number of connections
|
||||
} else {
|
||||
QReadLocker locker(&clientsLock);
|
||||
for (int i = 0; i < clients.size(); ++i)
|
||||
if (static_cast<ServerSocketInterface *>(clients[i])->getPeerAddress() == address)
|
||||
++result;
|
||||
}
|
||||
QReadLocker locker(&clientsLock);
|
||||
for (int i = 0; i < clients.size(); ++i)
|
||||
if (static_cast<ServerSocketInterface *>(clients[i])->getPeerAddress() == address)
|
||||
++result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue