Update c-icap to 0.3.5
Fix OpenSSL support by renaming CONF to CI_CONF
This commit is contained in:
parent
5aa831df17
commit
4a8b8df3ac
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=373018
9 changed files with 593 additions and 5 deletions
|
@ -2,8 +2,7 @@
|
|||
# $FreeBSD$
|
||||
|
||||
PORTNAME= c-icap
|
||||
PORTVERSION= 0.3.3
|
||||
PORTREVISION= 4
|
||||
PORTVERSION= 0.3.5
|
||||
PORTEPOCH= 2
|
||||
CATEGORIES= www
|
||||
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/0.3.x/
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
SHA256 (c_icap-0.3.3.tar.gz) = 9fc0d7166e65b748138b750f1cba27933aab6ac201fbe2279ab9d7a9c24c7131
|
||||
SIZE (c_icap-0.3.3.tar.gz) = 600209
|
||||
SHA256 (c_icap-0.3.5.tar.gz) = 46b97fab73dbb9e8def8e34c3f94048c92f50a5341bb85bec4f6f6349aec529a
|
||||
SIZE (c_icap-0.3.5.tar.gz) = 614388
|
||||
|
|
42
www/c-icap/files/patch-aserver.c
Normal file
42
www/c-icap/files/patch-aserver.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
--- aserver.c.orig 2014-11-21 23:14:37.959523762 +0100
|
||||
+++ aserver.c 2014-11-21 23:15:01.595515118 +0100
|
||||
@@ -125,9 +125,9 @@
|
||||
ci_txt_template_set_dir(DATADIR"templates");
|
||||
commands_init();
|
||||
|
||||
- if (!(CONF.MAGIC_DB = ci_magic_db_load(CONF.magics_file))) {
|
||||
+ if (!(CI_CONF.MAGIC_DB = ci_magic_db_load(CI_CONF.magics_file))) {
|
||||
ci_debug_printf(1, "Can not load magic file %s!!!\n",
|
||||
- CONF.magics_file);
|
||||
+ CI_CONF.magics_file);
|
||||
}
|
||||
init_conf_tables();
|
||||
request_stats_init();
|
||||
@@ -143,22 +143,22 @@
|
||||
}
|
||||
|
||||
#if ! defined(_WIN32)
|
||||
- if (is_icap_running(CONF.PIDFILE)) {
|
||||
+ if (is_icap_running(CI_CONF.PIDFILE)) {
|
||||
ci_debug_printf(1, "c-icap server already running!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if (DAEMON_MODE)
|
||||
run_as_daemon();
|
||||
- if (!set_running_permissions(CONF.RUN_USER, CONF.RUN_GROUP))
|
||||
+ if (!set_running_permissions(CI_CONF.RUN_USER, CI_CONF.RUN_GROUP))
|
||||
exit(-1);
|
||||
- store_pid(CONF.PIDFILE);
|
||||
+ store_pid(CI_CONF.PIDFILE);
|
||||
#endif
|
||||
|
||||
- if (!init_server(CONF.ADDRESS, CONF.PORT, &(CONF.PROTOCOL_FAMILY)))
|
||||
+ if (!init_server(CI_CONF.ADDRESS, CI_CONF.PORT, &(CI_CONF.PROTOCOL_FAMILY)))
|
||||
return -1;
|
||||
post_init_modules();
|
||||
post_init_services();
|
||||
start_server();
|
||||
- clear_pid(CONF.PIDFILE);
|
||||
+ clear_pid(CI_CONF.PIDFILE);
|
||||
return 0;
|
||||
}
|
183
www/c-icap/files/patch-cfg_param.c
Normal file
183
www/c-icap/files/patch-cfg_param.c
Normal file
|
@ -0,0 +1,183 @@
|
|||
--- cfg_param.c.orig 2014-11-21 23:05:59.123552647 +0100
|
||||
+++ cfg_param.c 2014-11-21 23:08:29.362542582 +0100
|
||||
@@ -40,7 +40,7 @@
|
||||
int ARGC;
|
||||
char **ARGV;
|
||||
|
||||
-struct ci_server_conf CONF = {
|
||||
+struct ci_server_conf CI_CONF = {
|
||||
NULL, /* LISTEN ADDRESS */ 1344, /*PORT*/ AF_INET, /*SOCK_FAMILY */
|
||||
#ifdef _WIN32
|
||||
"c:\\TEMP", /*TMPDIR*/ "c:\\TEMP\\c-icap.pid", /*PIDFILE*/ "\\\\.\\pipe\\c-icap", /*COMMANDS_SOCKET; */
|
||||
@@ -134,34 +134,34 @@
|
||||
};
|
||||
|
||||
static struct ci_conf_entry conf_variables[] = {
|
||||
- {"ListenAddress", &CONF.ADDRESS, intl_cfg_set_str, NULL},
|
||||
- {"PidFile", &CONF.PIDFILE, intl_cfg_set_str, NULL},
|
||||
- {"CommandsSocket", &CONF.COMMANDS_SOCKET, intl_cfg_set_str, NULL},
|
||||
+ {"ListenAddress", &CI_CONF.ADDRESS, intl_cfg_set_str, NULL},
|
||||
+ {"PidFile", &CI_CONF.PIDFILE, intl_cfg_set_str, NULL},
|
||||
+ {"CommandsSocket", &CI_CONF.COMMANDS_SOCKET, intl_cfg_set_str, NULL},
|
||||
{"Timeout", (void *) (&TIMEOUT), intl_cfg_set_int, NULL},
|
||||
{"KeepAlive", NULL, NULL, NULL},
|
||||
{"MaxKeepAliveRequests", &MAX_KEEPALIVE_REQUESTS, intl_cfg_set_int, NULL},
|
||||
{"KeepAliveTimeout", &KEEPALIVE_TIMEOUT, intl_cfg_set_int, NULL},
|
||||
- {"StartServers", &CONF.START_SERVERS, intl_cfg_set_int, NULL},
|
||||
- {"MaxServers", &CONF.MAX_SERVERS, intl_cfg_set_int, NULL},
|
||||
- {"MinSpareThreads", &CONF.MIN_SPARE_THREADS, intl_cfg_set_int, NULL},
|
||||
- {"MaxSpareThreads", &CONF.MAX_SPARE_THREADS, intl_cfg_set_int, NULL},
|
||||
- {"ThreadsPerChild", &CONF.THREADS_PER_CHILD, intl_cfg_set_int, NULL},
|
||||
+ {"StartServers", &CI_CONF.START_SERVERS, intl_cfg_set_int, NULL},
|
||||
+ {"MaxServers", &CI_CONF.MAX_SERVERS, intl_cfg_set_int, NULL},
|
||||
+ {"MinSpareThreads", &CI_CONF.MIN_SPARE_THREADS, intl_cfg_set_int, NULL},
|
||||
+ {"MaxSpareThreads", &CI_CONF.MAX_SPARE_THREADS, intl_cfg_set_int, NULL},
|
||||
+ {"ThreadsPerChild", &CI_CONF.THREADS_PER_CHILD, intl_cfg_set_int, NULL},
|
||||
{"MaxRequestsPerChild", &MAX_REQUESTS_PER_CHILD, intl_cfg_set_int, NULL},
|
||||
{"MaxRequestsReallocateMem", &MAX_REQUESTS_BEFORE_REALLOCATE_MEM,
|
||||
intl_cfg_set_int, NULL},
|
||||
- {"Port", &CONF.PORT, intl_cfg_set_int, NULL},
|
||||
- {"User", &CONF.RUN_USER, intl_cfg_set_str, NULL},
|
||||
- {"Group", &CONF.RUN_GROUP, intl_cfg_set_str, NULL},
|
||||
- {"ServerAdmin", &CONF.SERVER_ADMIN, intl_cfg_set_str, NULL},
|
||||
- {"ServerName", &CONF.SERVER_NAME, intl_cfg_set_str, NULL},
|
||||
+ {"Port", &CI_CONF.PORT, intl_cfg_set_int, NULL},
|
||||
+ {"User", &CI_CONF.RUN_USER, intl_cfg_set_str, NULL},
|
||||
+ {"Group", &CI_CONF.RUN_GROUP, intl_cfg_set_str, NULL},
|
||||
+ {"ServerAdmin", &CI_CONF.SERVER_ADMIN, intl_cfg_set_str, NULL},
|
||||
+ {"ServerName", &CI_CONF.SERVER_NAME, intl_cfg_set_str, NULL},
|
||||
{"LoadMagicFile", NULL, cfg_load_magicfile, NULL},
|
||||
{"Logger", &default_logger, cfg_set_logger, NULL},
|
||||
{"ServerLog", &SERVER_LOG_FILE, intl_cfg_set_str, NULL},
|
||||
{"AccessLog", NULL, cfg_set_accesslog, NULL},
|
||||
{"LogFormat", NULL, cfg_set_logformat, NULL},
|
||||
{"DebugLevel", NULL, cfg_set_debug_level, NULL}, /*Set library's debug level */
|
||||
- {"ServicesDir", &CONF.SERVICES_DIR, intl_cfg_set_str, NULL},
|
||||
- {"ModulesDir", &CONF.MODULES_DIR, intl_cfg_set_str, NULL},
|
||||
+ {"ServicesDir", &CI_CONF.SERVICES_DIR, intl_cfg_set_str, NULL},
|
||||
+ {"ModulesDir", &CI_CONF.MODULES_DIR, intl_cfg_set_str, NULL},
|
||||
{"Service", NULL, cfg_load_service, NULL},
|
||||
{"ServiceAlias", NULL, cfg_service_alias, NULL},
|
||||
{"Module", NULL, cfg_load_module, NULL},
|
||||
@@ -451,7 +451,7 @@
|
||||
}
|
||||
|
||||
db_file = argv[0];
|
||||
- if (strcmp(CONF.magics_file, db_file) == 0) {
|
||||
+ if (strcmp(CI_CONF.magics_file, db_file) == 0) {
|
||||
ci_debug_printf(2, "The db file %s is the same as default. Ignoring...\n", db_file);
|
||||
return 1;
|
||||
}
|
||||
@@ -461,8 +461,8 @@
|
||||
ci_debug_printf(1, "Can not load magic file %s!!!\n", db_file);
|
||||
return 0;
|
||||
}
|
||||
- if (!CONF.MAGIC_DB)
|
||||
- CONF.MAGIC_DB = ndb;
|
||||
+ if (!CI_CONF.MAGIC_DB)
|
||||
+ CI_CONF.MAGIC_DB = ndb;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -517,24 +517,24 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- cfg_default_value_store(&CONF.TMPDIR, &CONF.TMPDIR, sizeof(char *));
|
||||
+ cfg_default_value_store(&CI_CONF.TMPDIR, &CI_CONF.TMPDIR, sizeof(char *));
|
||||
len = strlen(argv[0]);
|
||||
|
||||
- CONF.TMPDIR = ci_cfg_alloc_mem((len + 2) * sizeof(char));
|
||||
- strcpy(CONF.TMPDIR, argv[0]);
|
||||
+ CI_CONF.TMPDIR = ci_cfg_alloc_mem((len + 2) * sizeof(char));
|
||||
+ strcpy(CI_CONF.TMPDIR, argv[0]);
|
||||
#ifdef _WIN32
|
||||
- if (CONF.TMPDIR[len] != '\\') {
|
||||
- CONF.TMPDIR[len] = '\\';
|
||||
- CONF.TMPDIR[len + 1] = '\0';
|
||||
+ if (CI_CONF.TMPDIR[len] != '\\') {
|
||||
+ CI_CONF.TMPDIR[len] = '\\';
|
||||
+ CI_CONF.TMPDIR[len + 1] = '\0';
|
||||
}
|
||||
#else
|
||||
- if (CONF.TMPDIR[len] != '/') {
|
||||
- CONF.TMPDIR[len] = '/';
|
||||
- CONF.TMPDIR[len + 1] = '\0';
|
||||
+ if (CI_CONF.TMPDIR[len] != '/') {
|
||||
+ CI_CONF.TMPDIR[len] = '/';
|
||||
+ CI_CONF.TMPDIR[len + 1] = '\0';
|
||||
}
|
||||
#endif
|
||||
/*Check if tmpdir exists. If no try to build it , report an error and uses the default... */
|
||||
- CI_TMPDIR = CONF.TMPDIR; /*Sets the library's temporary dir to .... */
|
||||
+ CI_TMPDIR = CI_CONF.TMPDIR; /*Sets the library's temporary dir to .... */
|
||||
ci_debug_printf(2, "Setting parameter :%s=%s\n", directive, argv[0]);
|
||||
return 1;
|
||||
}
|
||||
@@ -842,7 +842,7 @@
|
||||
/* #endif */
|
||||
|
||||
static struct ci_options_entry options[] = {
|
||||
- {opt_pre "f", "filename", &CONF.cfg_file, ci_cfg_set_str,
|
||||
+ {opt_pre "f", "filename", &CI_CONF.cfg_file, ci_cfg_set_str,
|
||||
"Specify the configuration file"},
|
||||
{opt_pre "N", NULL, &DAEMON_MODE, ci_cfg_disable, "Do not run as daemon"},
|
||||
{opt_pre "d", "level", NULL, cfg_set_debug_level_cmd,
|
||||
@@ -864,7 +864,7 @@
|
||||
ci_args_usage(argv[0], options);
|
||||
exit(-1);
|
||||
}
|
||||
- if (!parse_file(CONF.cfg_file)) {
|
||||
+ if (!parse_file(CI_CONF.cfg_file)) {
|
||||
ci_debug_printf(1, "Error opening/parsing config file\n");
|
||||
exit(0);
|
||||
}
|
||||
@@ -883,7 +883,7 @@
|
||||
"Error in command line options, while reconfiguring!\n");
|
||||
return 0;
|
||||
}
|
||||
- if (!parse_file(CONF.cfg_file)) {
|
||||
+ if (!parse_file(CI_CONF.cfg_file)) {
|
||||
ci_debug_printf(1,
|
||||
"Error opening/parsing config file, while reconfiguring!\n");
|
||||
return 0;
|
||||
@@ -923,7 +923,7 @@
|
||||
Release other subsystems
|
||||
*/
|
||||
ci_magic_db_free();
|
||||
- CONF.MAGIC_DB = NULL;
|
||||
+ CI_CONF.MAGIC_DB = NULL;
|
||||
ci_txt_template_close();
|
||||
}
|
||||
|
||||
@@ -939,9 +939,9 @@
|
||||
|
||||
ci_debug_printf(1, "All resources released. Going to reload!\n");
|
||||
ci_txt_template_init();
|
||||
- if (!(CONF.MAGIC_DB = ci_magic_db_load(CONF.magics_file))) {
|
||||
+ if (!(CI_CONF.MAGIC_DB = ci_magic_db_load(CI_CONF.magics_file))) {
|
||||
ci_debug_printf(1, "Can not load magic file %s!!!\n",
|
||||
- CONF.magics_file);
|
||||
+ CI_CONF.magics_file);
|
||||
}
|
||||
init_modules();
|
||||
init_services();
|
||||
@@ -950,15 +950,15 @@
|
||||
- Freeing all memory and resources used by configuration parameters (is it possible???)
|
||||
- reopen and read config file. Now the monitor process has now the new config parameters.
|
||||
*/
|
||||
- old_port = CONF.PORT;
|
||||
+ old_port = CI_CONF.PORT;
|
||||
if (!reconfig())
|
||||
return 0;
|
||||
|
||||
/*
|
||||
- reinit listen socket if needed
|
||||
*/
|
||||
- if (old_port != CONF.PORT) {
|
||||
- init_server(CONF.ADDRESS, CONF.PORT, &(CONF.PROTOCOL_FAMILY));
|
||||
+ if (old_port != CI_CONF.PORT) {
|
||||
+ init_server(CI_CONF.ADDRESS, CI_CONF.PORT, &(CI_CONF.PROTOCOL_FAMILY));
|
||||
}
|
||||
|
||||
log_open();
|
11
www/c-icap/files/patch-include__cfg_param.h
Normal file
11
www/c-icap/files/patch-include__cfg_param.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- include/cfg_param.h.orig 2014-11-21 23:04:39.814559345 +0100
|
||||
+++ include/cfg_param.h 2014-11-21 23:05:10.489615374 +0100
|
||||
@@ -126,7 +126,7 @@
|
||||
#define ALIAS_TABLE 2
|
||||
|
||||
#ifndef CI_BUILD_LIB
|
||||
-extern struct ci_server_conf CONF;
|
||||
+extern struct ci_server_conf CI_CONF;
|
||||
|
||||
struct cfg_default_value * cfg_default_value_store(void *param, void *value,int size);
|
||||
struct cfg_default_value * cfg_default_value_replace(void *param, void *value);
|
146
www/c-icap/files/patch-module.c
Normal file
146
www/c-icap/files/patch-module.c
Normal file
|
@ -0,0 +1,146 @@
|
|||
--- module.c.orig 2014-11-21 23:10:30.682534594 +0100
|
||||
+++ module.c 2014-11-21 23:13:53.911520262 +0100
|
||||
@@ -71,7 +71,7 @@
|
||||
void *module = NULL;
|
||||
CI_DLIB_HANDLE module_handle;
|
||||
|
||||
- module_handle = ci_module_load(module_file, CONF.MODULES_DIR);
|
||||
+ module_handle = ci_module_load(module_file, CI_CONF.MODULES_DIR);
|
||||
if (!module_handle)
|
||||
return NULL;
|
||||
module = ci_module_sym(module_handle, "module");
|
||||
@@ -146,7 +146,7 @@
|
||||
if (((service_handler_module_t *) module)->init_service_handler)
|
||||
ret =
|
||||
((service_handler_module_t *) module)->
|
||||
- init_service_handler(&CONF);
|
||||
+ init_service_handler(&CI_CONF);
|
||||
if (((service_handler_module_t *) module)->conf_table)
|
||||
register_conf_table(((service_handler_module_t *) module)->name,
|
||||
((service_handler_module_t *) module)->
|
||||
@@ -154,7 +154,7 @@
|
||||
break;
|
||||
case LOGGER:
|
||||
if (((logger_module_t *) module)->init_logger)
|
||||
- ret = ((logger_module_t *) module)->init_logger(&CONF);
|
||||
+ ret = ((logger_module_t *) module)->init_logger(&CI_CONF);
|
||||
if (((logger_module_t *) module)->conf_table)
|
||||
register_conf_table(((logger_module_t *) module)->name,
|
||||
((logger_module_t *) module)->conf_table,
|
||||
@@ -165,7 +165,7 @@
|
||||
if (((access_control_module_t *) module)->init_access_controller)
|
||||
ret =
|
||||
((access_control_module_t *) module)->
|
||||
- init_access_controller(&CONF);
|
||||
+ init_access_controller(&CI_CONF);
|
||||
if (((access_control_module_t *) module)->conf_table)
|
||||
register_conf_table(((access_control_module_t *) module)->name,
|
||||
((access_control_module_t *) module)->
|
||||
@@ -173,7 +173,7 @@
|
||||
break;
|
||||
case AUTH_METHOD:
|
||||
if (((http_auth_method_t *) module)->init_auth_method)
|
||||
- ret = ((http_auth_method_t *) module)->init_auth_method(&CONF);
|
||||
+ ret = ((http_auth_method_t *) module)->init_auth_method(&CI_CONF);
|
||||
if (((http_auth_method_t *) module)->conf_table)
|
||||
register_conf_table(((http_auth_method_t *) module)->name,
|
||||
((http_auth_method_t *) module)->conf_table,
|
||||
@@ -184,7 +184,7 @@
|
||||
if (((authenticator_module_t *) module)->init_authenticator)
|
||||
ret =
|
||||
((authenticator_module_t *) module)->
|
||||
- init_authenticator(&CONF);
|
||||
+ init_authenticator(&CI_CONF);
|
||||
if (((authenticator_module_t *) module)->conf_table)
|
||||
register_conf_table(((authenticator_module_t *) module)->name,
|
||||
((authenticator_module_t *) module)->
|
||||
@@ -192,7 +192,7 @@
|
||||
break;
|
||||
case COMMON:
|
||||
if (((common_module_t *) module)->init_module)
|
||||
- ret = ((common_module_t *) module)->init_module(&CONF);
|
||||
+ ret = ((common_module_t *) module)->init_module(&CI_CONF);
|
||||
if (((common_module_t *) module)->conf_table)
|
||||
register_conf_table(((common_module_t *) module)->name,
|
||||
((common_module_t *) module)->conf_table,
|
||||
@@ -607,7 +607,7 @@
|
||||
if (((common_module_t *) common_modules.modules[i])->
|
||||
post_init_module != NULL)
|
||||
((common_module_t *) common_modules.modules[i])->
|
||||
- post_init_module(&CONF);
|
||||
+ post_init_module(&CI_CONF);
|
||||
}
|
||||
|
||||
/* service_handlers */
|
||||
@@ -615,7 +615,7 @@
|
||||
if (((service_handler_module_t *) service_handlers.modules[i])->
|
||||
post_init_service_handler != NULL)
|
||||
((service_handler_module_t *) service_handlers.modules[i])->
|
||||
- post_init_service_handler(&CONF);
|
||||
+ post_init_service_handler(&CI_CONF);
|
||||
}
|
||||
|
||||
/* loggers? loggers do not have post init handlers .... */
|
||||
@@ -626,7 +626,7 @@
|
||||
if (((access_control_module_t *) access_controllers.modules[i])->
|
||||
post_init_access_controller != NULL)
|
||||
((access_control_module_t *) access_controllers.modules[i])->
|
||||
- post_init_access_controller(&CONF);
|
||||
+ post_init_access_controller(&CI_CONF);
|
||||
}
|
||||
|
||||
|
||||
@@ -636,7 +636,7 @@
|
||||
if (((http_auth_method_t *) auth_methods.modules[i])->
|
||||
post_init_auth_method != NULL)
|
||||
((http_auth_method_t *) auth_methods.modules[i])->
|
||||
- post_init_auth_method(&CONF);
|
||||
+ post_init_auth_method(&CI_CONF);
|
||||
}
|
||||
|
||||
/* authenticators */
|
||||
@@ -644,7 +644,7 @@
|
||||
if (((authenticator_module_t *) authenticators.modules[i])->
|
||||
post_init_authenticator != NULL)
|
||||
((authenticator_module_t *) authenticators.modules[i])->
|
||||
- post_init_authenticator(&CONF);
|
||||
+ post_init_authenticator(&CI_CONF);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -684,7 +684,7 @@
|
||||
if (((access_control_module_t *) access_controllers.modules[i])->
|
||||
release_access_controller != NULL)
|
||||
((access_control_module_t *) access_controllers.modules[i])->
|
||||
- release_access_controller(&CONF);
|
||||
+ release_access_controller(&CI_CONF);
|
||||
}
|
||||
RELEASE_MOD_LIST(access_controllers);
|
||||
|
||||
@@ -693,7 +693,7 @@
|
||||
if (((http_auth_method_t *) auth_methods.modules[i])->
|
||||
close_auth_method != NULL)
|
||||
((http_auth_method_t *) auth_methods.modules[i])->
|
||||
- close_auth_method(&CONF);
|
||||
+ close_auth_method(&CI_CONF);
|
||||
}
|
||||
RELEASE_MOD_LIST(auth_methods);
|
||||
|
||||
@@ -702,7 +702,7 @@
|
||||
if (((authenticator_module_t *) authenticators.modules[i])->
|
||||
close_authenticator != NULL)
|
||||
((authenticator_module_t *) authenticators.modules[i])->
|
||||
- close_authenticator(&CONF);
|
||||
+ close_authenticator(&CI_CONF);
|
||||
}
|
||||
RELEASE_MOD_LIST(authenticators);
|
||||
|
||||
@@ -711,7 +711,7 @@
|
||||
if (((common_module_t *) common_modules.modules[i])->
|
||||
close_module != NULL)
|
||||
((common_module_t *) common_modules.modules[i])->
|
||||
- close_module(&CONF);
|
||||
+ close_module(&CI_CONF);
|
||||
}
|
||||
RELEASE_MOD_LIST(common_modules);
|
||||
|
178
www/c-icap/files/patch-mpmt_server.c
Normal file
178
www/c-icap/files/patch-mpmt_server.c
Normal file
|
@ -0,0 +1,178 @@
|
|||
--- mpmt_server.c.orig 2014-11-21 23:11:15.384531606 +0100
|
||||
+++ mpmt_server.c 2014-11-21 23:11:47.359529681 +0100
|
||||
@@ -49,7 +49,7 @@
|
||||
extern int MAX_SECS_TO_LINGER;
|
||||
extern int MAX_REQUESTS_BEFORE_REALLOCATE_MEM;
|
||||
extern int MAX_REQUESTS_PER_CHILD;
|
||||
-extern struct ci_server_conf CONF;
|
||||
+extern struct ci_server_conf CI_CONF;
|
||||
|
||||
typedef struct server_decl {
|
||||
int srv_id;
|
||||
@@ -232,13 +232,13 @@
|
||||
ci_thread_cond_broadcast(&(con_queue->queue_cond));
|
||||
/*wait for a milisecond*/
|
||||
ci_usleep(1000);
|
||||
- servers_running = CONF.THREADS_PER_CHILD;
|
||||
+ servers_running = CI_CONF.THREADS_PER_CHILD;
|
||||
while (servers_running && wait_for_workers >= 0) {
|
||||
/*child_data->to_be_killed, may change while we are inside this loop*/
|
||||
if (child_data->to_be_killed == IMMEDIATELY) {
|
||||
CHILD_HALT = 1;
|
||||
}
|
||||
- for (i=0; i<CONF.THREADS_PER_CHILD; i++) {
|
||||
+ for (i=0; i<CI_CONF.THREADS_PER_CHILD; i++) {
|
||||
if (threads_list[i] != NULL) { /* if the i thread is still alive*/
|
||||
if (!threads_list[i]->running) { /*if the i thread is not running any more*/
|
||||
ci_debug_printf(5, "Cancel server %d, thread_id %lu (%d)\n",
|
||||
@@ -257,7 +257,7 @@
|
||||
}
|
||||
}
|
||||
}/*the i thread is still alive*/
|
||||
- } /* for(i=0;i< CONF.THREADS_PER_CHILD;i++)*/
|
||||
+ } /* for(i=0;i< CI_CONF.THREADS_PER_CHILD;i++)*/
|
||||
|
||||
/*wait for 1 second for the next round*/
|
||||
ci_usleep(999999);
|
||||
@@ -411,7 +411,7 @@
|
||||
*/
|
||||
old_childs_queue = childs_queue;
|
||||
childs_queue = malloc(sizeof(struct childs_queue));
|
||||
- if (!create_childs_queue(childs_queue, 2 * CONF.MAX_SERVERS)) {
|
||||
+ if (!create_childs_queue(childs_queue, 2 * CI_CONF.MAX_SERVERS)) {
|
||||
ci_debug_printf(1,
|
||||
"Cannot init shared memory. Fatal error, exiting!\n");
|
||||
return 0; /*It is not enough. We must wait all childs to exit ..... */
|
||||
@@ -419,10 +419,10 @@
|
||||
/*
|
||||
Start new childs to handle new requests.
|
||||
*/
|
||||
- if (CONF.START_SERVERS > CONF.MAX_SERVERS)
|
||||
- CONF.START_SERVERS = CONF.MAX_SERVERS;
|
||||
+ if (CI_CONF.START_SERVERS > CI_CONF.MAX_SERVERS)
|
||||
+ CI_CONF.START_SERVERS = CI_CONF.MAX_SERVERS;
|
||||
|
||||
- for (i = 0; i < CONF.START_SERVERS; i++) {
|
||||
+ for (i = 0; i < CI_CONF.START_SERVERS; i++) {
|
||||
start_child(LISTEN_SOCKET);
|
||||
}
|
||||
|
||||
@@ -851,11 +851,11 @@
|
||||
ci_stat_attach_mem(child_data->stats, child_data->stats_size, NULL);
|
||||
|
||||
threads_list =
|
||||
- (server_decl_t **) malloc((CONF.THREADS_PER_CHILD + 1) *
|
||||
+ (server_decl_t **) malloc((CI_CONF.THREADS_PER_CHILD + 1) *
|
||||
sizeof(server_decl_t *));
|
||||
- con_queue = init_queue(CONF.THREADS_PER_CHILD);
|
||||
+ con_queue = init_queue(CI_CONF.THREADS_PER_CHILD);
|
||||
|
||||
- for (i = 0; i < CONF.THREADS_PER_CHILD; i++) {
|
||||
+ for (i = 0; i < CI_CONF.THREADS_PER_CHILD; i++) {
|
||||
if ((threads_list[i] = newthread(con_queue)) == NULL) {
|
||||
exit(-1); // FATAL error.....
|
||||
}
|
||||
@@ -864,7 +864,7 @@
|
||||
(void *) threads_list[i]);
|
||||
threads_list[i]->srv_pthread = thread;
|
||||
}
|
||||
- threads_list[CONF.THREADS_PER_CHILD] = NULL;
|
||||
+ threads_list[CI_CONF.THREADS_PER_CHILD] = NULL;
|
||||
/*Now start the listener thread.... */
|
||||
ret = ci_thread_create(&thread, (void *(*)(void *)) listener_thread,
|
||||
(void *) &sockfd);
|
||||
@@ -957,7 +957,7 @@
|
||||
MY_PROC_PID = getpid();
|
||||
attach_childs_queue(childs_queue);
|
||||
child_data =
|
||||
- register_child(childs_queue, getpid(), CONF.THREADS_PER_CHILD, pfd[1]);
|
||||
+ register_child(childs_queue, getpid(), CI_CONF.THREADS_PER_CHILD, pfd[1]);
|
||||
close(pfd[1]);
|
||||
child_main(fd, pfd[0]);
|
||||
exit(0);
|
||||
@@ -1026,11 +1026,11 @@
|
||||
char command_buffer[COMMANDS_BUFFER_SIZE];
|
||||
int user_informed = 0;
|
||||
|
||||
- ctl_socket = ci_named_pipe_create(CONF.COMMANDS_SOCKET);
|
||||
+ ctl_socket = ci_named_pipe_create(CI_CONF.COMMANDS_SOCKET);
|
||||
if (ctl_socket < 0) {
|
||||
ci_debug_printf(1,
|
||||
"Error opening control socket %s. Fatal error, exiting!\n",
|
||||
- CONF.COMMANDS_SOCKET);
|
||||
+ CI_CONF.COMMANDS_SOCKET);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@
|
||||
exit(0);
|
||||
}
|
||||
childs_queue = malloc(sizeof(struct childs_queue));
|
||||
- if (!create_childs_queue(childs_queue, 2 * CONF.MAX_SERVERS)) {
|
||||
+ if (!create_childs_queue(childs_queue, 2 * CI_CONF.MAX_SERVERS)) {
|
||||
ci_proc_mutex_destroy(&accept_mutex);
|
||||
ci_debug_printf(1,
|
||||
"Can't init shared memory. Fatal error, exiting!\n");
|
||||
@@ -1050,10 +1050,10 @@
|
||||
init_commands();
|
||||
pid = 1;
|
||||
#ifdef MULTICHILD
|
||||
- if (CONF.START_SERVERS > CONF.MAX_SERVERS)
|
||||
- CONF.START_SERVERS = CONF.MAX_SERVERS;
|
||||
+ if (CI_CONF.START_SERVERS > CI_CONF.MAX_SERVERS)
|
||||
+ CI_CONF.START_SERVERS = CI_CONF.MAX_SERVERS;
|
||||
|
||||
- for (i = 0; i < CONF.START_SERVERS; i++) {
|
||||
+ for (i = 0; i < CI_CONF.START_SERVERS; i++) {
|
||||
if (pid)
|
||||
pid = start_child(LISTEN_SOCKET);
|
||||
}
|
||||
@@ -1068,7 +1068,7 @@
|
||||
}
|
||||
if (ret < 0) { /*Eof received on pipe. Going to reopen ... */
|
||||
ci_named_pipe_close(ctl_socket);
|
||||
- ctl_socket = ci_named_pipe_open(CONF.COMMANDS_SOCKET);
|
||||
+ ctl_socket = ci_named_pipe_open(CI_CONF.COMMANDS_SOCKET);
|
||||
if (ctl_socket < 0) {
|
||||
ci_debug_printf(1,
|
||||
"Error opening control socket. We are unstable and going down!");
|
||||
@@ -1100,16 +1100,16 @@
|
||||
kill(childs_queue->childs[child_indx].pid, SIGTERM);
|
||||
|
||||
}
|
||||
- else if ((freeservers <= CONF.MIN_SPARE_THREADS && childs < CONF.MAX_SERVERS)
|
||||
- || childs < CONF.START_SERVERS) {
|
||||
+ else if ((freeservers <= CI_CONF.MIN_SPARE_THREADS && childs < CI_CONF.MAX_SERVERS)
|
||||
+ || childs < CI_CONF.START_SERVERS) {
|
||||
ci_debug_printf(8,
|
||||
"Free Servers: %d, children: %d. Going to start a child .....\n",
|
||||
freeservers, childs);
|
||||
pid = start_child(LISTEN_SOCKET);
|
||||
}
|
||||
- else if (freeservers >= CONF.MAX_SPARE_THREADS &&
|
||||
- childs > CONF.START_SERVERS &&
|
||||
- (freeservers - CONF.THREADS_PER_CHILD) > CONF.MIN_SPARE_THREADS) {
|
||||
+ else if (freeservers >= CI_CONF.MAX_SPARE_THREADS &&
|
||||
+ childs > CI_CONF.START_SERVERS &&
|
||||
+ (freeservers - CI_CONF.THREADS_PER_CHILD) > CI_CONF.MIN_SPARE_THREADS) {
|
||||
|
||||
if ((child_indx = find_an_idle_child(childs_queue)) >= 0) {
|
||||
childs_queue->childs[child_indx].father_said =
|
||||
@@ -1124,7 +1124,7 @@
|
||||
user_informed = 0;
|
||||
}
|
||||
}
|
||||
- else if (childs == CONF.MAX_SERVERS && freeservers < CONF.MIN_SPARE_THREADS) {
|
||||
+ else if (childs == CI_CONF.MAX_SERVERS && freeservers < CI_CONF.MIN_SPARE_THREADS) {
|
||||
if(! user_informed) {
|
||||
ci_debug_printf(1,
|
||||
"ATTENTION!!!! Not enough available servers (children %d, free servers %d, used servers %d)!!!!! "
|
||||
@@ -1155,7 +1155,7 @@
|
||||
#else
|
||||
child_data = (child_shared_data_t *) malloc(sizeof(child_shared_data_t));
|
||||
child_data->pid = 0;
|
||||
- child_data->freeservers = CONF.THREADS_PER_CHILD;
|
||||
+ child_data->freeservers = CI_CONF.THREADS_PER_CHILD;
|
||||
child_data->usedservers = 0;
|
||||
child_data->requests = 0;
|
||||
child_data->connections = 0;
|
29
www/c-icap/files/patch-service.c
Normal file
29
www/c-icap/files/patch-service.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
--- service.c.orig 2014-11-21 23:12:01.548529197 +0100
|
||||
+++ service.c 2014-11-21 23:15:36.951514636 +0100
|
||||
@@ -368,7 +368,7 @@
|
||||
xdata = &service_extra_data_list[services_num];
|
||||
init_extra_data(xdata, service->mod_name);
|
||||
if (service->mod_init_service) {
|
||||
- ret = service->mod_init_service(xdata, &CONF);
|
||||
+ ret = service->mod_init_service(xdata, &CI_CONF);
|
||||
if (ret != CI_OK)
|
||||
xdata->status = CI_SERVICE_ERROR;
|
||||
else
|
||||
@@ -449,7 +449,7 @@
|
||||
xdata = &service_extra_data_list[i];
|
||||
if ( xdata->status == CI_SERVICE_OK) {
|
||||
ret = service_list[i]->
|
||||
- mod_post_init_service(xdata, &CONF);
|
||||
+ mod_post_init_service(xdata, &CI_CONF);
|
||||
if (ret != CI_OK)
|
||||
xdata->status = CI_SERVICE_ERROR;
|
||||
}
|
||||
@@ -608,7 +608,7 @@
|
||||
ci_service_module_t *service = NULL;
|
||||
CI_DLIB_HANDLE service_handle;
|
||||
|
||||
- service_handle = ci_module_load(service_file, CONF.SERVICES_DIR);
|
||||
+ service_handle = ci_module_load(service_file, CI_CONF.SERVICES_DIR);
|
||||
if (!service_handle)
|
||||
return NULL;
|
||||
service = ci_module_sym(service_handle, "service");
|
|
@ -54,7 +54,7 @@ lib/c_icap/sys_logger.so
|
|||
@dirrm lib/c_icap
|
||||
lib/libicapapi.so
|
||||
lib/libicapapi.so.3
|
||||
lib/libicapapi.so.3.0.3
|
||||
lib/libicapapi.so.3.0.5
|
||||
man/man8/c-icap-client.8.gz
|
||||
man/man8/c-icap-config.8.gz
|
||||
man/man8/c-icap-libicapapi-config.8.gz
|
||||
|
|
Loading…
Reference in a new issue