Merge pull request #441 from woogerboy21/servatrice_trustedsources
Servatrice trustedsources
This commit is contained in:
commit
8b0d67ea5c
3 changed files with 631 additions and 613 deletions
|
@ -125,6 +125,11 @@ max_game_inactivity_time=120
|
|||
; Maximum number of users that can connect from the same IP address; useful to avoid bots, default is 4
|
||||
max_users_per_address=4
|
||||
|
||||
; You may want to allow an unlimited number of users from a trusted source. This setting can contain a
|
||||
; comma-separed list of IP addresses which will allow an unlimited number of connections from each of the
|
||||
; IP addresses listed (ignoring the max_users_per_address). Default is "127.0.0.1,::1"; example: "192.73.233.244,81.4.100.74"
|
||||
trusted_sources="127.0.0.1,::1"
|
||||
|
||||
; Servatrice can avoid users from flooding rooms with large number messages in an interval of time.
|
||||
; This setting defines the length in seconds of the considered interval; default is 10
|
||||
message_counting_interval=10
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <iostream>
|
||||
#include "servatrice.h"
|
||||
#include "servatrice_database_interface.h"
|
||||
|
@ -381,8 +382,9 @@ int Servatrice::getUsersWithAddress(const QHostAddress &address) const
|
|||
int result = 0;
|
||||
QReadLocker locker(&clientsLock);
|
||||
for (int i = 0; i < clients.size(); ++i)
|
||||
if (static_cast<ServerSocketInterface *>(clients[i])->getPeerAddress() == address)
|
||||
++result;
|
||||
if (static_cast<ServerSocketInterface *>(clients[i])->getPeerAddress() == address)
|
||||
++result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue