Skip to content

Commit 449756e

Browse files
author
Jérôme Loyet
committed
revert commit 293414
1 parent dd9c6a3 commit 449756e

File tree

2 files changed

+0
-67
lines changed

2 files changed

+0
-67
lines changed

sapi/fpm/fpm/fpm_conf.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,6 @@ int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc) /* {{{ */
297297
free(wpc->pm->status);
298298
free(wpc->pm->ping);
299299
free(wpc->pm->pong);
300-
free(wpc->sticky_cookie);
301-
free(wpc->sticky_route);
302300
if (wpc->listen_options) {
303301
free(wpc->listen_options->owner);
304302
free(wpc->listen_options->group);
@@ -349,9 +347,6 @@ static struct xml_conf_section xml_section_fpm_worker_pool_config = {
349347
{ XML_CONF_SCALAR, "rlimit_files", &xml_conf_set_slot_integer, offsetof(struct fpm_worker_pool_config_s, rlimit_files) },
350348
{ XML_CONF_SCALAR, "rlimit_core", &fpm_conf_set_rlimit_core, 0 },
351349
{ XML_CONF_SCALAR, "max_requests", &xml_conf_set_slot_integer, offsetof(struct fpm_worker_pool_config_s, max_requests) },
352-
{ XML_CONF_SCALAR, "sticky", &xml_conf_set_slot_boolean, offsetof(struct fpm_worker_pool_config_s, sticky) },
353-
{ XML_CONF_SCALAR, "sticky_cookie", &xml_conf_set_slot_string, offsetof(struct fpm_worker_pool_config_s, sticky_cookie) },
354-
{ XML_CONF_SCALAR, "sticky_route", &xml_conf_set_slot_string, offsetof(struct fpm_worker_pool_config_s, sticky_route) },
355350
{ XML_CONF_SCALAR, "catch_workers_output", &fpm_conf_set_catch_workers_output, 0 },
356351
{ XML_CONF_SUBSECTION, "pm", &fpm_conf_set_pm_subsection, offsetof(struct fpm_worker_pool_config_s, pm) },
357352
{ 0, 0, 0, 0 }
@@ -480,64 +475,6 @@ static int fpm_conf_process_all_pools() /* {{{ */
480475
close(fd);
481476
}
482477
}
483-
if (wp->config->sticky) {
484-
char *cookie = wp->config->sticky_cookie;
485-
char *route = wp->config->sticky_route;
486-
int i;
487-
488-
if (!cookie) {
489-
wp->config->sticky_cookie = strdup("FPMCOOKIE");
490-
} else {
491-
if (strlen(cookie) < 2) {
492-
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky cookie '%s' is not long enough", wp->config->name, cookie);
493-
return(-1);
494-
}
495-
496-
for (i=0; i<strlen(cookie); i++) {
497-
if (!isalnum(cookie[i])) {
498-
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky cookie '%s' must containt only the alphanum characters", wp->config->name, cookie);
499-
return(-1);
500-
}
501-
}
502-
}
503-
504-
if (!route) {
505-
char *hostname;
506-
hostname = malloc(sizeof(char) * (FPM_CONF_MAX_HOSTNAME_LENGTH + 1));
507-
if (!hostname) {
508-
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] sticky: unable to malloc memory for hostname", wp->config->name);
509-
return(-1);
510-
}
511-
if (gethostname(hostname, FPM_CONF_MAX_HOSTNAME_LENGTH) != 0) {
512-
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] sticky: unable to retrieve hostname", wp->config->name);
513-
return(-1);
514-
}
515-
hostname[FPM_CONF_MAX_HOSTNAME_LENGTH] = '\0';
516-
wp->config->sticky_route = strdup(hostname);
517-
zlog(ZLOG_STUFF, ZLOG_NOTICE, "[pool %s] the sticky route has been set to the local hostname '%s'", wp->config->name, wp->config->sticky_route);
518-
free(hostname);
519-
} else {
520-
if (strlen(route) < 2) {
521-
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky route '%s' is not long enough", wp->config->name, route);
522-
return(-1);
523-
}
524-
525-
for (i=0; i<strlen(route); i++) {
526-
if (!isalnum(route[i])) {
527-
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky route '%s' must containt only the alphanum characters", wp->config->name, route);
528-
return(-1);
529-
}
530-
}
531-
}
532-
zlog(ZLOG_STUFF, ZLOG_NOTICE, "[pool %s] sticky is set to %s=%s", wp->config->name, wp->config->sticky_cookie, wp->config->sticky_route);
533-
} else {
534-
if (wp->config->sticky_route) {
535-
free(wp->config->sticky_route);
536-
}
537-
if (wp->config->sticky_cookie) {
538-
free(wp->config->sticky_cookie);
539-
}
540-
}
541478

542479
if (wp->config->pm->ping && *wp->config->pm->ping) {
543480
char *ping = wp->config->pm->ping;

sapi/fpm/fpm/fpm_conf.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#define FPM_CONF_H 1
77

88
#define FPM_CONF_MAX_PONG_LENGTH 64
9-
#define FPM_CONF_MAX_HOSTNAME_LENGTH 255
109

1110
struct key_value_s;
1211

@@ -65,9 +64,6 @@ struct fpm_worker_pool_config_s {
6564
int max_requests;
6665
int rlimit_files;
6766
int rlimit_core;
68-
int sticky;
69-
char *sticky_cookie;
70-
char *sticky_route;
7167
unsigned catch_workers_output:1;
7268
};
7369

0 commit comments

Comments
 (0)