Change: Add separate setting for server sent commands per frame limit (#11023)

Set a higher default value for this setting.
Use the higher of this and existing commands per frame limit
setting for server-originating commands, e.g. GS.

This is to support the GSAsyncMode class.
This also avoids undue throttling when more than one
script is in operation (e.g. AIs).
This commit is contained in:
Jonathan G Rennison 2023-06-27 12:32:45 +01:00 committed by GitHub
parent 8465559488
commit 55c07eed59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -392,6 +392,10 @@ static void DistributeQueue(CommandQueue *queue, const NetworkClientSocket *owne
int to_go = UINT16_MAX; int to_go = UINT16_MAX;
#else #else
int to_go = _settings_client.network.commands_per_frame; int to_go = _settings_client.network.commands_per_frame;
if (owner == nullptr) {
/* This is the server, use the commands_per_frame_server setting if higher */
to_go = std::max<int>(to_go, _settings_client.network.commands_per_frame_server);
}
#endif #endif
CommandPacket *cp; CommandPacket *cp;

View File

@ -279,6 +279,7 @@ struct NetworkSettings {
uint16 sync_freq; ///< how often do we check whether we are still in-sync uint16 sync_freq; ///< how often do we check whether we are still in-sync
uint8 frame_freq; ///< how often do we send commands to the clients uint8 frame_freq; ///< how often do we send commands to the clients
uint16 commands_per_frame; ///< how many commands may be sent each frame_freq frames? uint16 commands_per_frame; ///< how many commands may be sent each frame_freq frames?
uint16 commands_per_frame_server; ///< how many commands may be sent each frame_freq frames? (server-originating commands)
uint16 max_commands_in_queue; ///< how many commands may there be in the incoming queue before dropping the connection? uint16 max_commands_in_queue; ///< how many commands may there be in the incoming queue before dropping the connection?
uint16 bytes_per_frame; ///< how many bytes may, over a long period, be received per frame? uint16 bytes_per_frame; ///< how many bytes may, over a long period, be received per frame?
uint16 bytes_per_frame_burst; ///< how many bytes may, over a short period, be received? uint16 bytes_per_frame_burst; ///< how many bytes may, over a short period, be received?

View File

@ -66,6 +66,15 @@ min = 1
max = 65535 max = 65535
cat = SC_EXPERT cat = SC_EXPERT
[SDTC_VAR]
var = network.commands_per_frame_server
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 16
min = 1
max = 65535
cat = SC_EXPERT
[SDTC_VAR] [SDTC_VAR]
var = network.max_commands_in_queue var = network.max_commands_in_queue
type = SLE_UINT16 type = SLE_UINT16