added logic to only write debug if max user value is reached
This commit is contained in:
parent
197ae9213c
commit
37e08cfbb6
1 changed files with 4 additions and 2 deletions
|
@ -117,14 +117,16 @@ bool ServerSocketInterface::initSession()
|
||||||
SessionEvent *identSe = prepareSessionEvent(identEvent);
|
SessionEvent *identSe = prepareSessionEvent(identEvent);
|
||||||
sendProtocolItem(*identSe);
|
sendProtocolItem(*identSe);
|
||||||
delete identSe;
|
delete identSe;
|
||||||
|
|
||||||
|
int maxUsers = servatrice->getMaxUsersPerAddress();
|
||||||
|
|
||||||
//allow unlimited number of connections from the trusted sources
|
//allow unlimited number of connections from the trusted sources
|
||||||
QString trustedSources = settingsCache->value("server/trusted_sources","127.0.0.1,::1").toString();
|
QString trustedSources = settingsCache->value("server/trusted_sources","127.0.0.1,::1").toString();
|
||||||
if (trustedSources.contains(socket->peerAddress().toString(),Qt::CaseInsensitive))
|
if (trustedSources.contains(socket->peerAddress().toString(),Qt::CaseInsensitive))
|
||||||
qDebug() << "Allowing user from trusted source: " << socket->peerAddress().toString();
|
if (servatrice->getUsersWithAddress(socket->peerAddress()) >= maxUsers)
|
||||||
|
qDebug() << "Allowing user from trusted source: " << socket->peerAddress().toString();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int maxUsers = servatrice->getMaxUsersPerAddress();
|
|
||||||
if ((maxUsers > 0) && (servatrice->getUsersWithAddress(socket->peerAddress()) >= maxUsers)) {
|
if ((maxUsers > 0) && (servatrice->getUsersWithAddress(socket->peerAddress()) >= maxUsers)) {
|
||||||
Event_ConnectionClosed event;
|
Event_ConnectionClosed event;
|
||||||
event.set_reason(Event_ConnectionClosed::TOO_MANY_CONNECTIONS);
|
event.set_reason(Event_ConnectionClosed::TOO_MANY_CONNECTIONS);
|
||||||
|
|
Loading…
Reference in a new issue