Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
a2f416bb
Commit
a2f416bb
authored
Apr 13, 2015
by
poixen
Browse files
Merge pull request #959 from poixen/server_command_limit
Server was using message limit for commands
parents
2d2d0384
b9cda5e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
common/server_protocolhandler.cpp
View file @
a2f416bb
...
@@ -234,7 +234,7 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
...
@@ -234,7 +234,7 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
return
Response
::
RespNotInRoom
;
return
Response
::
RespNotInRoom
;
int
commandCountingInterval
=
server
->
getCommandCountingInterval
();
int
commandCountingInterval
=
server
->
getCommandCountingInterval
();
int
max
Message
CountPerInterval
=
server
->
getMax
Message
CountPerInterval
();
int
max
Command
CountPerInterval
=
server
->
getMax
Command
CountPerInterval
();
GameEventStorage
ges
;
GameEventStorage
ges
;
Response
::
ResponseCode
finalResponseCode
=
Response
::
RespOk
;
Response
::
ResponseCode
finalResponseCode
=
Response
::
RespOk
;
for
(
int
i
=
cont
.
game_command_size
()
-
1
;
i
>=
0
;
--
i
)
{
for
(
int
i
=
cont
.
game_command_size
()
-
1
;
i
>=
0
;
--
i
)
{
...
@@ -252,7 +252,7 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
...
@@ -252,7 +252,7 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
for
(
int
i
=
0
;
i
<
commandCountOverTime
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
commandCountOverTime
.
size
();
++
i
)
totalCount
+=
commandCountOverTime
[
i
];
totalCount
+=
commandCountOverTime
[
i
];
if
(
totalCount
>
max
Message
CountPerInterval
)
if
(
totalCount
>
max
Command
CountPerInterval
)
return
Response
::
RespChatFlood
;
return
Response
::
RespChatFlood
;
}
}
...
...
servatrice/servatrice.ini.example
View file @
a2f416bb
...
@@ -147,8 +147,8 @@ max_games_per_user=5
...
@@ -147,8 +147,8 @@ max_games_per_user=5
; This setting defines the length in seconds of the considered interval; default is 10
; This setting defines the length in seconds of the considered interval; default is 10
command_counting_interval=10
command_counting_interval=10
; Maximum number of game commands in an interval before new commands gets dropped; default is
1
0
; Maximum number of game commands in an interval before new commands gets dropped; default is
2
0
max_command_count_per_interval=
1
0
max_command_count_per_interval=
2
0
[logging]
[logging]
...
...
servatrice/src/servatrice.cpp
View file @
a2f416bb
...
@@ -260,7 +260,7 @@ bool Servatrice::initServer()
...
@@ -260,7 +260,7 @@ bool Servatrice::initServer()
maxMessageSizePerInterval
=
settingsCache
->
value
(
"security/max_message_size_per_interval"
,
1000
).
toInt
();
maxMessageSizePerInterval
=
settingsCache
->
value
(
"security/max_message_size_per_interval"
,
1000
).
toInt
();
maxGamesPerUser
=
settingsCache
->
value
(
"security/max_games_per_user"
,
5
).
toInt
();
maxGamesPerUser
=
settingsCache
->
value
(
"security/max_games_per_user"
,
5
).
toInt
();
commandCountingInterval
=
settingsCache
->
value
(
"game/command_counting_interval"
,
10
).
toInt
();
commandCountingInterval
=
settingsCache
->
value
(
"game/command_counting_interval"
,
10
).
toInt
();
maxCommandCountPerInterval
=
settingsCache
->
value
(
"game/max_command_count_per_interval"
,
1
0
).
toInt
();
maxCommandCountPerInterval
=
settingsCache
->
value
(
"game/max_command_count_per_interval"
,
2
0
).
toInt
();
try
{
if
(
settingsCache
->
value
(
"servernetwork/active"
,
0
).
toInt
())
{
try
{
if
(
settingsCache
->
value
(
"servernetwork/active"
,
0
).
toInt
())
{
qDebug
()
<<
"Connecting to ISL network."
;
qDebug
()
<<
"Connecting to ISL network."
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment