client/Global: use struct ConfigData
This commit is contained in:
		| @@ -576,7 +576,7 @@ try { | ||||
| 		partition.UpdateEffectiveReplayGainMode(); | ||||
| 	} | ||||
|  | ||||
| 	client_manager_init(); | ||||
| 	client_manager_init(raw_config); | ||||
| 	input_stream_global_init(raw_config, | ||||
| 				 instance->io_thread.GetEventLoop()); | ||||
| 	playlist_list_global_init(raw_config); | ||||
|   | ||||
| @@ -37,6 +37,7 @@ | ||||
|  | ||||
| #include <stddef.h> | ||||
|  | ||||
| struct ConfigData; | ||||
| class SocketAddress; | ||||
| class UniqueSocketDescriptor; | ||||
| class EventLoop; | ||||
| @@ -237,7 +238,7 @@ private: | ||||
| }; | ||||
|  | ||||
| void | ||||
| client_manager_init(); | ||||
| client_manager_init(const ConfigData &config); | ||||
|  | ||||
| void | ||||
| client_new(EventLoop &loop, Partition &partition, | ||||
|   | ||||
| @@ -19,7 +19,7 @@ | ||||
|  | ||||
| #include "config.h" | ||||
| #include "ClientInternal.hxx" | ||||
| #include "config/Global.hxx" | ||||
| #include "config/Data.hxx" | ||||
|  | ||||
| #define CLIENT_TIMEOUT_DEFAULT			(60) | ||||
| #define CLIENT_MAX_COMMAND_LIST_DEFAULT		(2048*1024) | ||||
| @@ -29,19 +29,20 @@ std::chrono::steady_clock::duration client_timeout; | ||||
| size_t client_max_command_list_size; | ||||
| size_t client_max_output_buffer_size; | ||||
|  | ||||
| void client_manager_init(void) | ||||
| void | ||||
| client_manager_init(const ConfigData &config) | ||||
| { | ||||
| 	unsigned client_timeout_s = config_get_positive(ConfigOption::CONN_TIMEOUT, | ||||
| 							CLIENT_TIMEOUT_DEFAULT); | ||||
| 	unsigned client_timeout_s = config.GetPositive(ConfigOption::CONN_TIMEOUT, | ||||
| 						       CLIENT_TIMEOUT_DEFAULT); | ||||
| 	client_timeout = std::chrono::seconds(client_timeout_s); | ||||
|  | ||||
| 	client_max_command_list_size = | ||||
| 		config_get_positive(ConfigOption::MAX_COMMAND_LIST_SIZE, | ||||
| 				    CLIENT_MAX_COMMAND_LIST_DEFAULT / 1024) | ||||
| 		config.GetPositive(ConfigOption::MAX_COMMAND_LIST_SIZE, | ||||
| 				   CLIENT_MAX_COMMAND_LIST_DEFAULT / 1024) | ||||
| 		* 1024; | ||||
|  | ||||
| 	client_max_output_buffer_size = | ||||
| 		config_get_positive(ConfigOption::MAX_OUTPUT_BUFFER_SIZE, | ||||
| 				    CLIENT_MAX_OUTPUT_BUFFER_SIZE_DEFAULT / 1024) | ||||
| 		config.GetPositive(ConfigOption::MAX_OUTPUT_BUFFER_SIZE, | ||||
| 				   CLIENT_MAX_OUTPUT_BUFFER_SIZE_DEFAULT / 1024) | ||||
| 		* 1024; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann