mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-07-25 15:04:30 +00:00
Split up renderd.conf processing by section type (#397)
This commit is contained in:
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
#include <mapnik/map.hpp>
|
#include <mapnik/map.hpp>
|
||||||
|
|
||||||
typedef void (*parameterize_function_ptr)(mapnik::Map &m, char * parameter);
|
typedef void (*parameterize_function_ptr)(mapnik::Map &m, char *parameter);
|
||||||
|
|
||||||
parameterize_function_ptr init_parameterization_function(char * function_name);
|
parameterize_function_ptr init_parameterization_function(const char *function_name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,31 +34,34 @@ int daemon(int nochdir, int noclose);
|
|||||||
#define MAX_SLAVES 5
|
#define MAX_SLAVES 5
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *iphostname;
|
const char *iphostname;
|
||||||
char *mapnik_font_dir;
|
const char *mapnik_font_dir;
|
||||||
char *mapnik_plugins_dir;
|
const char *mapnik_plugins_dir;
|
||||||
char *pid_filename;
|
const char *name;
|
||||||
char *socketname;
|
const char *pid_filename;
|
||||||
char *stats_filename;
|
const char *socketname;
|
||||||
char *tile_dir;
|
const char *stats_filename;
|
||||||
|
const char *tile_dir;
|
||||||
int ipport;
|
int ipport;
|
||||||
int mapnik_font_dir_recurse;
|
int mapnik_font_dir_recurse;
|
||||||
int num_threads;
|
int num_threads;
|
||||||
} renderd_config;
|
} renderd_config;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *attribution;
|
const char *attribution;
|
||||||
char *cors;
|
const char *cors;
|
||||||
char *description;
|
const char *description;
|
||||||
char *host;
|
const char *file_extension;
|
||||||
char *htcpip;
|
const char *host;
|
||||||
char *output_format;
|
const char *htcpip;
|
||||||
char *parameterization;
|
const char *mime_type;
|
||||||
char *server_alias;
|
const char *output_format;
|
||||||
char *tile_dir;
|
const char *parameterization;
|
||||||
char *xmlfile;
|
const char *server_alias;
|
||||||
char *xmlname;
|
const char *tile_dir;
|
||||||
char *xmluri;
|
const char *xmlfile;
|
||||||
|
const char *xmlname;
|
||||||
|
const char *xmluri;
|
||||||
double scale_factor;
|
double scale_factor;
|
||||||
int aspect_x;
|
int aspect_x;
|
||||||
int aspect_y;
|
int aspect_y;
|
||||||
|
@ -25,13 +25,20 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int num_slave_threads;
|
int num_slave_threads;
|
||||||
extern renderd_config config;
|
renderd_config config;
|
||||||
extern renderd_config config_slaves[MAX_SLAVES];
|
renderd_config config_slaves[MAX_SLAVES];
|
||||||
extern xmlconfigitem maps[XMLCONFIGS_MAX];
|
xmlconfigitem maps[XMLCONFIGS_MAX];
|
||||||
|
|
||||||
int min_max_int_opt(const char *opt_arg, const char *opt_type_name, int minimum, int maximum);
|
int min_max_int_opt(const char *opt_arg, const char *opt_type_name, int minimum, int maximum);
|
||||||
|
void free_map_section(xmlconfigitem map_section);
|
||||||
|
void free_map_sections(xmlconfigitem *map_sections);
|
||||||
|
void free_renderd_section(renderd_config renderd_section);
|
||||||
|
void free_renderd_sections(renderd_config *renderd_sections);
|
||||||
void process_config_file(const char *config_file_name, int active_renderd_section_num, int log_level);
|
void process_config_file(const char *config_file_name, int active_renderd_section_num, int log_level);
|
||||||
|
void process_map_sections(const char *config_file_name, xmlconfigitem *maps_dest, const char *default_tile_dir, int num_threads);
|
||||||
|
void process_mapnik_section(const char *config_file_name, renderd_config *config_dest);
|
||||||
|
void process_renderd_sections(const char *config_file_name, renderd_config *configs_dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -15,24 +15,22 @@
|
|||||||
* along with this program; If not, see http://www.gnu.org/licenses/.
|
* along with this program; If not, see http://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <mapnik/version.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <mapnik/map.hpp>
|
|
||||||
#include <mapnik/layer.hpp>
|
|
||||||
#include <mapnik/params.hpp>
|
|
||||||
#include <mapnik/datasource.hpp>
|
#include <mapnik/datasource.hpp>
|
||||||
#include <mapnik/datasource_cache.hpp>
|
#include <mapnik/datasource_cache.hpp>
|
||||||
|
#include <mapnik/layer.hpp>
|
||||||
|
#include <mapnik/map.hpp>
|
||||||
|
#include <mapnik/params.hpp>
|
||||||
|
#include <mapnik/version.hpp>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
#include "parameterize_style.hpp"
|
|
||||||
#include "g_logger.h"
|
#include "g_logger.h"
|
||||||
|
#include "parameterize_style.hpp"
|
||||||
|
|
||||||
|
static void parameterize_map_language(mapnik::Map &m, char *parameter)
|
||||||
static void parameterize_map_language(mapnik::Map &m, char * parameter)
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char * data = strdup(parameter);
|
char *data = strdup(parameter);
|
||||||
char * tok;
|
char *tok;
|
||||||
char name_replace[256];
|
char name_replace[256];
|
||||||
|
|
||||||
name_replace[0] = 0;
|
name_replace[0] = 0;
|
||||||
@ -41,7 +39,7 @@ static void parameterize_map_language(mapnik::Map &m, char * parameter)
|
|||||||
|
|
||||||
if (!tok) {
|
if (!tok) {
|
||||||
free(data);
|
free(data);
|
||||||
return; //No parameterization given
|
return; // No parameterization given
|
||||||
}
|
}
|
||||||
|
|
||||||
strncat(name_replace, ", coalesce(", 255);
|
strncat(name_replace, ", coalesce(", 255);
|
||||||
@ -56,7 +54,6 @@ static void parameterize_map_language(mapnik::Map &m, char * parameter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tok = strtok(NULL, ",");
|
tok = strtok(NULL, ",");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
@ -64,7 +61,7 @@ static void parameterize_map_language(mapnik::Map &m, char * parameter)
|
|||||||
strncat(name_replace, ") as name", 255);
|
strncat(name_replace, ") as name", 255);
|
||||||
|
|
||||||
for (i = 0; i < m.layer_count(); i++) {
|
for (i = 0; i < m.layer_count(); i++) {
|
||||||
mapnik::layer& l = m.get_layer(i);
|
mapnik::layer &l = m.get_layer(i);
|
||||||
mapnik::parameters params = l.datasource()->params();
|
mapnik::parameters params = l.datasource()->params();
|
||||||
|
|
||||||
if (params.find("table") != params.end()) {
|
if (params.find("table") != params.end()) {
|
||||||
@ -78,12 +75,10 @@ static void parameterize_map_language(mapnik::Map &m, char * parameter)
|
|||||||
l.set_datasource(mapnik::datasource_cache::instance().create(params));
|
l.set_datasource(mapnik::datasource_cache::instance().create(params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameterize_function_ptr init_parameterization_function(const char *function_name)
|
||||||
parameterize_function_ptr init_parameterization_function(char * function_name)
|
|
||||||
{
|
{
|
||||||
if (strcmp(function_name, "") == 0) {
|
if (strcmp(function_name, "") == 0) {
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "Parameterize_style not specified (or empty string specified)");
|
g_logger(G_LOG_LEVEL_DEBUG, "Parameterize_style not specified (or empty string specified)");
|
||||||
|
@ -745,7 +745,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'c': /* -c, --config */
|
case 'c': /* -c, --config */
|
||||||
config_file_name = strdup(optarg);
|
config_file_name = strndup(optarg, PATH_MAX);
|
||||||
config_file_name_passed = 1;
|
config_file_name_passed = 1;
|
||||||
|
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
@ -777,7 +777,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, " -V, --version display the version number and exit\n");
|
fprintf(stderr, " -V, --version display the version number and exit\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case 'V':
|
case 'V': /* -V, --version */
|
||||||
fprintf(stdout, "%s\n", VERSION);
|
fprintf(stdout, "%s\n", VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -799,6 +799,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
process_config_file(config_file_name, active_renderd_section_num, G_LOG_LEVEL_INFO);
|
process_config_file(config_file_name, active_renderd_section_num, G_LOG_LEVEL_INFO);
|
||||||
|
|
||||||
|
if (config_file_name_passed) {
|
||||||
|
free((void *)config_file_name);
|
||||||
|
}
|
||||||
|
|
||||||
fd = server_socket_init(&config);
|
fd = server_socket_init(&config);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -867,10 +871,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (active_renderd_section_num == 0) {
|
if (active_renderd_section_num == 0) {
|
||||||
//Only the master renderd opens connections to its slaves
|
// Only the master renderd opens connections to its slaves
|
||||||
k = 0;
|
k = 0;
|
||||||
slave_threads
|
slave_threads = (pthread_t *) malloc(sizeof(pthread_t) * num_slave_threads);
|
||||||
= (pthread_t *) malloc(sizeof(pthread_t) * num_slave_threads);
|
|
||||||
|
|
||||||
for (i = 1; i < MAX_SLAVES; i++) {
|
for (i = 1; i < MAX_SLAVES; i++) {
|
||||||
for (j = 0; j < config_slaves[i].num_threads; j++) {
|
for (j = 0; j < config_slaves[i].num_threads; j++) {
|
||||||
@ -881,6 +884,13 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < MAX_SLAVES; i++) {
|
||||||
|
if (active_renderd_section_num != i && config_slaves[i].num_threads != 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "Freeing unused renderd config section %i: %s", i, config_slaves[i].name);
|
||||||
|
free_renderd_section(config_slaves[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process_loop(fd);
|
process_loop(fd);
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
* along with this program; If not, see http://www.gnu.org/licenses/.
|
* along with this program; If not, see http://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "g_logger.h"
|
#include "g_logger.h"
|
||||||
#include "render_config.h"
|
#include "render_config.h"
|
||||||
@ -26,54 +28,27 @@
|
|||||||
#include <iniparser.h>
|
#include <iniparser.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int num_slave_threads;
|
static void copy_string(const char *src, const char **dest, size_t maxlen)
|
||||||
|
|
||||||
renderd_config config;
|
|
||||||
renderd_config config_slaves[MAX_SLAVES];
|
|
||||||
xmlconfigitem maps[XMLCONFIGS_MAX];
|
|
||||||
|
|
||||||
static void copy_string_with_snprintf(const char *src, char **dest, size_t maxlen)
|
|
||||||
{
|
{
|
||||||
int len, size;
|
size_t size = sizeof(char) * strnlen(src, maxlen);
|
||||||
|
|
||||||
size = sizeof(char) * strnlen(src, maxlen) + sizeof(char);
|
*dest = strndup(src, size);
|
||||||
*dest = malloc(size);
|
|
||||||
|
|
||||||
if (*dest == NULL) {
|
if (*dest == NULL) {
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "malloc error");
|
g_logger(G_LOG_LEVEL_CRITICAL, "copy_string: strndup error");
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
len = snprintf(*dest, size, "%s", src);
|
|
||||||
|
|
||||||
if (len < 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "snprintf encoding error");
|
|
||||||
exit(7);
|
|
||||||
} else if (len >= maxlen) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "snprintf buffer too small");
|
|
||||||
exit(7);
|
exit(7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *name_with_section(const char *section, const char *name)
|
static char *name_with_section(const char *section, const char *name)
|
||||||
{
|
{
|
||||||
int len, maxlen = INILINE_MAX - 1;
|
size_t len;
|
||||||
char *key;
|
char *key;
|
||||||
|
|
||||||
key = malloc(sizeof(char) * maxlen);
|
len = asprintf(&key, "%s:%s", section, name);
|
||||||
|
|
||||||
if (key == NULL) {
|
if (len == -1) {
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "malloc error");
|
g_logger(G_LOG_LEVEL_CRITICAL, "name_with_section: asprintf error");
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
len = snprintf(key, maxlen, "%s:%s", section, name);
|
|
||||||
|
|
||||||
if (len < 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "snprintf encoding error");
|
|
||||||
exit(7);
|
|
||||||
} else if (len >= maxlen) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "snprintf buffer too small");
|
|
||||||
exit(7);
|
exit(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,27 +91,73 @@ static void process_config_int(const dictionary *ini, const char *section, const
|
|||||||
free(key);
|
free(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_config_string(const dictionary *ini, const char *section, const char *name, char **dest, char *notfound, int maxlen)
|
static void process_config_string(const dictionary *ini, const char *section, const char *name, const char **dest, const char *notfound, size_t maxlen)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
char *key = name_with_section(section, name);
|
char *key = name_with_section(section, name);
|
||||||
const char *src = iniparser_getstring(ini, key, notfound);
|
const char *src = iniparser_getstring(ini, key, notfound);
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\tRead %s: '%s'", key, src);
|
g_logger(G_LOG_LEVEL_DEBUG, "\tRead %s: '%s'", key, src);
|
||||||
|
|
||||||
copy_string_with_snprintf(src, dest, maxlen);
|
copy_string(src, dest, maxlen);
|
||||||
|
|
||||||
free(key);
|
free(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_map_section(xmlconfigitem map_section)
|
||||||
|
{
|
||||||
|
free((void *)map_section.attribution);
|
||||||
|
free((void *)map_section.cors);
|
||||||
|
free((void *)map_section.description);
|
||||||
|
free((void *)map_section.file_extension);
|
||||||
|
free((void *)map_section.host);
|
||||||
|
free((void *)map_section.htcpip);
|
||||||
|
free((void *)map_section.mime_type);
|
||||||
|
free((void *)map_section.output_format);
|
||||||
|
free((void *)map_section.parameterization);
|
||||||
|
free((void *)map_section.server_alias);
|
||||||
|
free((void *)map_section.tile_dir);
|
||||||
|
free((void *)map_section.xmlfile);
|
||||||
|
free((void *)map_section.xmlname);
|
||||||
|
free((void *)map_section.xmluri);
|
||||||
|
bzero(&map_section, sizeof(xmlconfigitem));
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_map_sections(xmlconfigitem *map_sections)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < XMLCONFIGS_MAX; i++) {
|
||||||
|
if (map_sections[i].xmlname != NULL) {
|
||||||
|
free_map_section(map_sections[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_renderd_section(renderd_config renderd_section)
|
||||||
|
{
|
||||||
|
free((void *)renderd_section.iphostname);
|
||||||
|
free((void *)renderd_section.mapnik_font_dir);
|
||||||
|
free((void *)renderd_section.mapnik_plugins_dir);
|
||||||
|
free((void *)renderd_section.name);
|
||||||
|
free((void *)renderd_section.pid_filename);
|
||||||
|
free((void *)renderd_section.socketname);
|
||||||
|
free((void *)renderd_section.stats_filename);
|
||||||
|
free((void *)renderd_section.tile_dir);
|
||||||
|
bzero(&renderd_section, sizeof(renderd_config));
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_renderd_sections(renderd_config *renderd_sections)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAX_SLAVES; i++) {
|
||||||
|
if (renderd_sections[i].num_threads != 0) {
|
||||||
|
free_renderd_section(renderd_sections[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int min_max_int_opt(const char *opt_arg, const char *opt_type_name, int minimum, int maximum)
|
int min_max_int_opt(const char *opt_arg, const char *opt_type_name, int minimum, int maximum)
|
||||||
{
|
{
|
||||||
int opt;
|
|
||||||
float opt_float;
|
|
||||||
char *endptr, *endptr_float;
|
char *endptr, *endptr_float;
|
||||||
|
int opt = strtol(opt_arg, &endptr, 10);
|
||||||
opt = strtol(opt_arg, &endptr, 10);
|
float opt_float = strtof(opt_arg, &endptr_float);
|
||||||
opt_float = strtof(opt_arg, &endptr_float);
|
|
||||||
|
|
||||||
if (endptr == opt_arg || endptr_float == opt_arg || (float)opt != opt_float) {
|
if (endptr == opt_arg || endptr_float == opt_arg || (float)opt != opt_float) {
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Invalid %s, must be an integer (%s was provided)", opt_type_name, opt_arg);
|
g_logger(G_LOG_LEVEL_CRITICAL, "Invalid %s, must be an integer (%s was provided)", opt_type_name, opt_arg);
|
||||||
@ -152,14 +173,10 @@ int min_max_int_opt(const char *opt_arg, const char *opt_type_name, int minimum,
|
|||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_config_file(const char *config_file_name, int active_renderd_section_num, int log_level)
|
void process_map_sections(const char *config_file_name, xmlconfigitem *maps_dest, const char *default_tile_dir, int num_threads)
|
||||||
{
|
{
|
||||||
int i, map_section_num = -1;
|
int map_section_num = -1;
|
||||||
bzero(&config, sizeof(renderd_config));
|
|
||||||
bzero(config_slaves, sizeof(renderd_config) * MAX_SLAVES);
|
|
||||||
bzero(maps, sizeof(xmlconfigitem) * XMLCONFIGS_MAX);
|
|
||||||
|
|
||||||
g_logger(log_level, "Parsing renderd config file '%s':", config_file_name);
|
|
||||||
dictionary *ini = iniparser_load(config_file_name);
|
dictionary *ini = iniparser_load(config_file_name);
|
||||||
|
|
||||||
if (!ini) {
|
if (!ini) {
|
||||||
@ -167,7 +184,158 @@ void process_config_file(const char *config_file_name, int active_renderd_sectio
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_slave_threads = 0;
|
bzero(maps_dest, sizeof(xmlconfigitem) * XMLCONFIGS_MAX);
|
||||||
|
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "Parsing map config section(s)");
|
||||||
|
|
||||||
|
for (int section_num = 0; section_num < iniparser_getnsec(ini); section_num++) {
|
||||||
|
const char *section = iniparser_getsecname(ini, section_num);
|
||||||
|
|
||||||
|
if (strncmp(section, "renderd", 7) && strcmp(section, "mapnik")) {
|
||||||
|
/* this is a map config section */
|
||||||
|
map_section_num++;
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "Parsing map config section %i: %s", map_section_num, section);
|
||||||
|
|
||||||
|
if (map_section_num >= XMLCONFIGS_MAX) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Can't handle more than %i map config sections", XMLCONFIGS_MAX);
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_string(section, &maps_dest[map_section_num].xmlname, XMLCONFIG_MAX);
|
||||||
|
|
||||||
|
process_config_int(ini, section, "aspectx", &maps_dest[map_section_num].aspect_x, 1);
|
||||||
|
process_config_int(ini, section, "aspecty", &maps_dest[map_section_num].aspect_y, 1);
|
||||||
|
process_config_int(ini, section, "tilesize", &maps_dest[map_section_num].tile_px_size, 256);
|
||||||
|
process_config_string(ini, section, "attribution", &maps_dest[map_section_num].attribution, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "cors", &maps_dest[map_section_num].cors, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "description", &maps_dest[map_section_num].description, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "host", &maps_dest[map_section_num].host, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "htcphost", &maps_dest[map_section_num].htcpip, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "parameterize_style", &maps_dest[map_section_num].parameterization, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "server_alias", &maps_dest[map_section_num].server_alias, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "tiledir", &maps_dest[map_section_num].tile_dir, default_tile_dir, PATH_MAX);
|
||||||
|
process_config_string(ini, section, "uri", &maps_dest[map_section_num].xmluri, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "xml", &maps_dest[map_section_num].xmlfile, "", PATH_MAX);
|
||||||
|
|
||||||
|
process_config_double(ini, section, "scale", &maps_dest[map_section_num].scale_factor, 1.0);
|
||||||
|
|
||||||
|
if (maps_dest[map_section_num].scale_factor < 0.1) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified scale factor (%lf) is too small, must be greater than or equal to %lf.", maps_dest[map_section_num].scale_factor, 0.1);
|
||||||
|
exit(7);
|
||||||
|
} else if (maps_dest[map_section_num].scale_factor > 8.0) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified scale factor (%lf) is too large, must be less than or equal to %lf.", maps_dest[map_section_num].scale_factor, 8.0);
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
process_config_int(ini, section, "maxzoom", &maps_dest[map_section_num].max_zoom, MAX_ZOOM);
|
||||||
|
|
||||||
|
if (maps_dest[map_section_num].max_zoom < 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified max zoom (%i) is too small, must be greater than or equal to %i.", maps_dest[map_section_num].max_zoom, 0);
|
||||||
|
exit(7);
|
||||||
|
} else if (maps_dest[map_section_num].max_zoom > MAX_ZOOM) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified max zoom (%i) is too large, must be less than or equal to %i.", maps_dest[map_section_num].max_zoom, MAX_ZOOM);
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
process_config_int(ini, section, "minzoom", &maps_dest[map_section_num].min_zoom, 0);
|
||||||
|
|
||||||
|
if (maps_dest[map_section_num].min_zoom < 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified min zoom (%i) is too small, must be greater than or equal to %i.", maps_dest[map_section_num].min_zoom, 0);
|
||||||
|
exit(7);
|
||||||
|
} else if (maps_dest[map_section_num].min_zoom > maps_dest[map_section_num].max_zoom) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified min zoom (%i) is larger than max zoom (%i).", maps_dest[map_section_num].min_zoom, maps_dest[map_section_num].max_zoom);
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *file_extension = malloc(INILINE_MAX);
|
||||||
|
char *mime_type = malloc(INILINE_MAX);
|
||||||
|
char *output_format = malloc(INILINE_MAX);
|
||||||
|
const char *ini_type;
|
||||||
|
int num_ini_type_parts;
|
||||||
|
|
||||||
|
process_config_string(ini, section, "type", &ini_type, "png image/png png256", INILINE_MAX);
|
||||||
|
num_ini_type_parts = sscanf(ini_type, "%[^ ] %[^ ] %[^ ]", file_extension, mime_type, output_format);
|
||||||
|
|
||||||
|
if (num_ini_type_parts < 2) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Specified type (%s) has too few parts, there must be at least 2, e.g., 'png image/png'.", ini_type);
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_string(file_extension, &maps_dest[map_section_num].file_extension, INILINE_MAX);
|
||||||
|
copy_string(mime_type, &maps_dest[map_section_num].mime_type, INILINE_MAX);
|
||||||
|
|
||||||
|
if (num_ini_type_parts == 3) {
|
||||||
|
copy_string(output_format, &maps_dest[map_section_num].output_format, INILINE_MAX);
|
||||||
|
} else {
|
||||||
|
copy_string("png256", &maps_dest[map_section_num].output_format, INILINE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
free((void *)ini_type);
|
||||||
|
free(file_extension);
|
||||||
|
free(mime_type);
|
||||||
|
free(output_format);
|
||||||
|
|
||||||
|
/* Pass this information into the rendering threads,
|
||||||
|
* as it is needed to configure mapniks number of connections
|
||||||
|
*/
|
||||||
|
maps_dest[map_section_num].num_threads = num_threads;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iniparser_freedict(ini);
|
||||||
|
|
||||||
|
if (map_section_num < 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "No map config sections were found in file: %s", config_file_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_mapnik_section(const char *config_file_name, renderd_config *config_dest)
|
||||||
|
{
|
||||||
|
int mapnik_section_num = -1;
|
||||||
|
|
||||||
|
dictionary *ini = iniparser_load(config_file_name);
|
||||||
|
|
||||||
|
if (!ini) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Failed to load config file: %s", config_file_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "Parsing mapnik config section");
|
||||||
|
|
||||||
|
for (int section_num = 0; section_num < iniparser_getnsec(ini); section_num++) {
|
||||||
|
const char *section = iniparser_getsecname(ini, section_num);
|
||||||
|
|
||||||
|
if (strcmp(section, "mapnik") == 0) {
|
||||||
|
/* this is a mapnik config section */
|
||||||
|
mapnik_section_num = section_num;
|
||||||
|
process_config_bool(ini, section, "font_dir_recurse", &config_dest->mapnik_font_dir_recurse, MAPNIK_FONTS_DIR_RECURSE);
|
||||||
|
process_config_string(ini, section, "font_dir", &config_dest->mapnik_font_dir, MAPNIK_FONTS_DIR, PATH_MAX);
|
||||||
|
process_config_string(ini, section, "plugins_dir", &config_dest->mapnik_plugins_dir, MAPNIK_PLUGINS_DIR, PATH_MAX);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iniparser_freedict(ini);
|
||||||
|
|
||||||
|
if (mapnik_section_num < 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "No mapnik config section was found in file: %s", config_file_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_renderd_sections(const char *config_file_name, renderd_config *configs_dest)
|
||||||
|
{
|
||||||
|
int renderd_section_num = -1;
|
||||||
|
|
||||||
|
dictionary *ini = iniparser_load(config_file_name);
|
||||||
|
|
||||||
|
if (!ini) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "Failed to load config file: %s", config_file_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bzero(configs_dest, sizeof(renderd_config) * MAX_SLAVES);
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "Parsing renderd config section(s)");
|
g_logger(G_LOG_LEVEL_DEBUG, "Parsing renderd config section(s)");
|
||||||
|
|
||||||
@ -176,8 +344,6 @@ void process_config_file(const char *config_file_name, int active_renderd_sectio
|
|||||||
|
|
||||||
if (strncmp(section, "renderd", 7) == 0) {
|
if (strncmp(section, "renderd", 7) == 0) {
|
||||||
/* this is a renderd config section */
|
/* this is a renderd config section */
|
||||||
int renderd_section_num = 0;
|
|
||||||
|
|
||||||
if (sscanf(section, "renderd%i", &renderd_section_num) != 1) {
|
if (sscanf(section, "renderd%i", &renderd_section_num) != 1) {
|
||||||
renderd_section_num = 0;
|
renderd_section_num = 0;
|
||||||
}
|
}
|
||||||
@ -189,131 +355,74 @@ void process_config_file(const char *config_file_name, int active_renderd_sectio
|
|||||||
exit(7);
|
exit(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
process_config_int(ini, section, "ipport", &config_slaves[renderd_section_num].ipport, 0);
|
copy_string(section, &configs_dest[renderd_section_num].name, 10);
|
||||||
process_config_int(ini, section, "num_threads", &config_slaves[renderd_section_num].num_threads, NUM_THREADS);
|
|
||||||
process_config_string(ini, section, "iphostname", &config_slaves[renderd_section_num].iphostname, "", INILINE_MAX - 1);
|
|
||||||
process_config_string(ini, section, "pid_file", &config_slaves[renderd_section_num].pid_filename, RENDERD_PIDFILE, PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "socketname", &config_slaves[renderd_section_num].socketname, RENDERD_SOCKET, PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "stats_file", &config_slaves[renderd_section_num].stats_filename, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "tile_dir", &config_slaves[renderd_section_num].tile_dir, RENDERD_TILE_DIR, PATH_MAX - 1);
|
|
||||||
|
|
||||||
if (config_slaves[renderd_section_num].num_threads == -1) {
|
process_config_int(ini, section, "ipport", &configs_dest[renderd_section_num].ipport, 0);
|
||||||
config_slaves[renderd_section_num].num_threads = sysconf(_SC_NPROCESSORS_ONLN);
|
process_config_int(ini, section, "num_threads", &configs_dest[renderd_section_num].num_threads, NUM_THREADS);
|
||||||
|
process_config_string(ini, section, "iphostname", &configs_dest[renderd_section_num].iphostname, "", INILINE_MAX);
|
||||||
|
process_config_string(ini, section, "pid_file", &configs_dest[renderd_section_num].pid_filename, RENDERD_PIDFILE, PATH_MAX);
|
||||||
|
process_config_string(ini, section, "socketname", &configs_dest[renderd_section_num].socketname, RENDERD_SOCKET, PATH_MAX);
|
||||||
|
process_config_string(ini, section, "stats_file", &configs_dest[renderd_section_num].stats_filename, "", PATH_MAX);
|
||||||
|
process_config_string(ini, section, "tile_dir", &configs_dest[renderd_section_num].tile_dir, RENDERD_TILE_DIR, PATH_MAX);
|
||||||
|
|
||||||
|
if (configs_dest[renderd_section_num].num_threads == -1) {
|
||||||
|
configs_dest[renderd_section_num].num_threads = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderd_section_num == active_renderd_section_num) {
|
|
||||||
config = config_slaves[renderd_section_num];
|
|
||||||
} else {
|
|
||||||
num_slave_threads += config_slaves[renderd_section_num].num_threads;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "Parsing mapnik config section");
|
|
||||||
|
|
||||||
for (int section_num = 0; section_num < iniparser_getnsec(ini); section_num++) {
|
|
||||||
const char *section = iniparser_getsecname(ini, section_num);
|
|
||||||
|
|
||||||
if (strcmp(section, "mapnik") == 0) {
|
|
||||||
/* this is a mapnik config section */
|
|
||||||
if (config.num_threads == 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "No valid (active) renderd config section available");
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
process_config_bool(ini, section, "font_dir_recurse", &config.mapnik_font_dir_recurse, MAPNIK_FONTS_DIR_RECURSE);
|
|
||||||
process_config_string(ini, section, "font_dir", &config.mapnik_font_dir, MAPNIK_FONTS_DIR, PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "plugins_dir", &config.mapnik_plugins_dir, MAPNIK_PLUGINS_DIR, PATH_MAX - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "Parsing map config section(s)");
|
|
||||||
|
|
||||||
for (int section_num = 0; section_num < iniparser_getnsec(ini); section_num++) {
|
|
||||||
const char *section = iniparser_getsecname(ini, section_num);
|
|
||||||
|
|
||||||
if (strncmp(section, "renderd", 7) && strcmp(section, "mapnik")) {
|
|
||||||
/* this is a map config section */
|
|
||||||
if (config.num_threads == 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "No valid (active) renderd config section available");
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
map_section_num++;
|
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "Parsing map config section %i: %s", map_section_num, section);
|
|
||||||
|
|
||||||
if (map_section_num >= XMLCONFIGS_MAX) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Can't handle more than %i map config sections", XMLCONFIGS_MAX);
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_string_with_snprintf(section, &maps[map_section_num].xmlname, XMLCONFIG_MAX - 1);
|
|
||||||
|
|
||||||
process_config_int(ini, section, "aspectx", &maps[map_section_num].aspect_x, 1);
|
|
||||||
process_config_int(ini, section, "aspecty", &maps[map_section_num].aspect_y, 1);
|
|
||||||
process_config_int(ini, section, "tilesize", &maps[map_section_num].tile_px_size, 256);
|
|
||||||
process_config_string(ini, section, "attribution", &maps[map_section_num].attribution, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "cors", &maps[map_section_num].cors, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "description", &maps[map_section_num].description, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "host", &maps[map_section_num].host, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "htcphost", &maps[map_section_num].htcpip, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "parameterize_style", &maps[map_section_num].parameterization, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "server_alias", &maps[map_section_num].server_alias, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "tiledir", &maps[map_section_num].tile_dir, config.tile_dir, PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "uri", &maps[map_section_num].xmluri, "", PATH_MAX - 1);
|
|
||||||
process_config_string(ini, section, "xml", &maps[map_section_num].xmlfile, "", PATH_MAX - 1);
|
|
||||||
|
|
||||||
process_config_double(ini, section, "scale", &maps[map_section_num].scale_factor, 1.0);
|
|
||||||
|
|
||||||
if (maps[map_section_num].scale_factor < 0.1) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Specified scale factor (%lf) is too small, must be greater than or equal to %lf.", maps[map_section_num].scale_factor, 0.1);
|
|
||||||
exit(7);
|
|
||||||
} else if (maps[map_section_num].scale_factor > 8.0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Specified scale factor (%lf) is too large, must be less than or equal to %lf.", maps[map_section_num].scale_factor, 8.0);
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
process_config_int(ini, section, "maxzoom", &maps[map_section_num].max_zoom, 18);
|
|
||||||
|
|
||||||
if (maps[map_section_num].max_zoom < 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Specified max zoom (%i) is too small, must be greater than or equal to %i.", maps[map_section_num].max_zoom, 0);
|
|
||||||
exit(7);
|
|
||||||
} else if (maps[map_section_num].max_zoom > MAX_ZOOM) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Specified max zoom (%i) is too large, must be less than or equal to %i.", maps[map_section_num].max_zoom, MAX_ZOOM);
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
process_config_int(ini, section, "minzoom", &maps[map_section_num].min_zoom, 0);
|
|
||||||
|
|
||||||
if (maps[map_section_num].min_zoom < 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Specified min zoom (%i) is too small, must be greater than or equal to %i.", maps[map_section_num].min_zoom, 0);
|
|
||||||
exit(7);
|
|
||||||
} else if (maps[map_section_num].min_zoom > maps[map_section_num].max_zoom) {
|
|
||||||
g_logger(G_LOG_LEVEL_CRITICAL, "Specified min zoom (%i) is larger than max zoom (%i).", maps[map_section_num].min_zoom, maps[map_section_num].max_zoom);
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
char ini_fileExtension[] = "png";
|
|
||||||
char ini_mimeType[] = "image/png";
|
|
||||||
char ini_outputFormat[] = "png256";
|
|
||||||
char *ini_type;
|
|
||||||
|
|
||||||
process_config_string(ini, section, "type", &ini_type, "png image/png png256", INILINE_MAX - 1);
|
|
||||||
|
|
||||||
sscanf(ini_type, "%[^ ] %[^ ] %[^;#]", ini_fileExtension, ini_mimeType, ini_outputFormat);
|
|
||||||
copy_string_with_snprintf(ini_outputFormat, &maps[map_section_num].output_format, INILINE_MAX - 1);
|
|
||||||
free(ini_type);
|
|
||||||
|
|
||||||
/* Pass this information into the rendering threads,
|
|
||||||
* as it is needed to configure mapniks number of connections
|
|
||||||
*/
|
|
||||||
maps[map_section_num].num_threads = config.num_threads;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iniparser_freedict(ini);
|
iniparser_freedict(ini);
|
||||||
|
|
||||||
|
if (renderd_section_num < 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_CRITICAL, "No renderd config sections were found in file: %s", config_file_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_config_file(const char *config_file_name, int active_renderd_section_num, int log_level)
|
||||||
|
{
|
||||||
|
extern int num_slave_threads;
|
||||||
|
|
||||||
|
extern renderd_config config;
|
||||||
|
extern renderd_config config_slaves[MAX_SLAVES];
|
||||||
|
extern xmlconfigitem maps[XMLCONFIGS_MAX];
|
||||||
|
|
||||||
|
num_slave_threads = 0;
|
||||||
|
|
||||||
|
g_logger(log_level, "Parsing renderd config file '%s':", config_file_name);
|
||||||
|
|
||||||
|
process_renderd_sections(config_file_name, config_slaves);
|
||||||
|
process_mapnik_section(config_file_name, &config_slaves[active_renderd_section_num]);
|
||||||
|
process_map_sections(config_file_name, maps, config_slaves[active_renderd_section_num].tile_dir, config_slaves[active_renderd_section_num].num_threads);
|
||||||
|
config = config_slaves[active_renderd_section_num];
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_SLAVES; i++) {
|
||||||
|
if (config_slaves[i].num_threads == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == active_renderd_section_num) {
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): Active", i);
|
||||||
|
} else {
|
||||||
|
num_slave_threads += config_slaves[i].num_threads;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config_slaves[i].ipport > 0) {
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): ip socket = '%s:%i'", i, config_slaves[i].iphostname, config_slaves[i].ipport);
|
||||||
|
} else {
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): unix socketname = '%s'", i, config_slaves[i].socketname);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): num_threads = '%i'", i, config_slaves[i].num_threads);
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): pid_file = '%s'", i, config_slaves[i].pid_filename);
|
||||||
|
|
||||||
|
if (strnlen(config_slaves[i].stats_filename, PATH_MAX)) {
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): stats_file = '%s'", i, config_slaves[i].stats_filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): tile_dir = '%s'", i, config_slaves[i].tile_dir);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.ipport > 0) {
|
if (config.ipport > 0) {
|
||||||
g_logger(log_level, "\trenderd: ip socket = '%s':%i", config.iphostname, config.ipport);
|
g_logger(log_level, "\trenderd: ip socket = '%s':%i", config.iphostname, config.ipport);
|
||||||
} else {
|
} else {
|
||||||
@ -328,7 +437,7 @@ void process_config_file(const char *config_file_name, int active_renderd_sectio
|
|||||||
|
|
||||||
g_logger(log_level, "\trenderd: pid_file = '%s'", config.pid_filename);
|
g_logger(log_level, "\trenderd: pid_file = '%s'", config.pid_filename);
|
||||||
|
|
||||||
if (strnlen(config.stats_filename, PATH_MAX - 1)) {
|
if (strnlen(config.stats_filename, PATH_MAX)) {
|
||||||
g_logger(log_level, "\trenderd: stats_file = '%s'", config.stats_filename);
|
g_logger(log_level, "\trenderd: stats_file = '%s'", config.stats_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,34 +446,9 @@ void process_config_file(const char *config_file_name, int active_renderd_sectio
|
|||||||
g_logger(log_level, "\tmapnik: font_dir_recurse = '%s'", config.mapnik_font_dir_recurse ? "true" : "false");
|
g_logger(log_level, "\tmapnik: font_dir_recurse = '%s'", config.mapnik_font_dir_recurse ? "true" : "false");
|
||||||
g_logger(log_level, "\tmapnik: plugins_dir = '%s'", config.mapnik_plugins_dir);
|
g_logger(log_level, "\tmapnik: plugins_dir = '%s'", config.mapnik_plugins_dir);
|
||||||
|
|
||||||
for (i = 0; i < XMLCONFIGS_MAX; i++) {
|
for (int i = 0; i < XMLCONFIGS_MAX; i++) {
|
||||||
if (maps[i].xmlname != NULL) {
|
if (maps[i].xmlname != NULL) {
|
||||||
g_logger(log_level, "\tmap %i: name(%s) file(%s) uri(%s) output_format(%s) htcp(%s) host(%s)", i, maps[i].xmlname, maps[i].xmlfile, maps[i].xmluri, maps[i].output_format, maps[i].htcpip, maps[i].host);
|
g_logger(log_level, "\tmap %i: name(%s) file(%s) uri(%s) output_format(%s) htcp(%s) host(%s)", i, maps[i].xmlname, maps[i].xmlfile, maps[i].xmluri, maps[i].output_format, maps[i].htcpip, maps[i].host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_SLAVES; i++) {
|
|
||||||
if (config_slaves[i].num_threads == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == active_renderd_section_num) {
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): Active", i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config_slaves[i].ipport > 0) {
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): ip socket = '%s:%i'", i, config_slaves[i].iphostname, config_slaves[i].ipport);
|
|
||||||
} else {
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): unix socketname = '%s'", i, config_slaves[i].socketname);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): num_threads = '%i'", i, config_slaves[i].num_threads);
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): pid_file = '%s'", i, config_slaves[i].pid_filename);
|
|
||||||
|
|
||||||
if (strnlen(config_slaves[i].stats_filename, PATH_MAX - 1)) {
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): stats_file = '%s'", i, config_slaves[i].stats_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_logger(G_LOG_LEVEL_DEBUG, "\trenderd(%i): tile_dir = '%s'", i, config_slaves[i].tile_dir);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
|
|||||||
${PS_EXECUTABLE} -p \${PID} || exit 1\;
|
${PS_EXECUTABLE} -p \${PID} || exit 1\;
|
||||||
echo \${PID} > ${RENDERD1_PID}"
|
echo \${PID} > ${RENDERD1_PID}"
|
||||||
"$<TARGET_FILE:renderd> --config ${RENDERD_CONF} --slave 2"
|
"$<TARGET_FILE:renderd> --config ${RENDERD_CONF} --slave 2"
|
||||||
"${HTTPD_EXECUTABLE} -e debug -f ${HTTPD_CONF} -k start > ${HTTPD_LOG} 2>&1"
|
"${HTTPD_EXECUTABLE} -e debug -E ${HTTPD_LOG} -f ${HTTPD_CONF} -k start"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Conditionally append memcached start commands to SERVICES_START_CMDS based on STORAGE_BACKEND value
|
# Conditionally append memcached start commands to SERVICES_START_CMDS based on STORAGE_BACKEND value
|
||||||
@ -647,13 +647,17 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
|
|||||||
set_tests_properties(tile_expired_${MAP_NAME}_${STORAGE_BACKEND} PROPERTIES
|
set_tests_properties(tile_expired_${MAP_NAME}_${STORAGE_BACKEND} PROPERTIES
|
||||||
FIXTURES_REQUIRED services_started_${STORAGE_BACKEND}
|
FIXTURES_REQUIRED services_started_${STORAGE_BACKEND}
|
||||||
)
|
)
|
||||||
|
set(TILE_URL_PATH "/tiles/${MAP_NAME}/3/0/3.${EXTENSION}")
|
||||||
|
set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}")
|
||||||
|
set(HTTPD2_URL "http://${HTTPD2_HOST}:${HTTPD2_PORT}${TILE_URL_PATH}")
|
||||||
add_test(NAME throttling_xforward_${MAP_NAME}_${STORAGE_BACKEND}
|
add_test(NAME throttling_xforward_${MAP_NAME}_${STORAGE_BACKEND}
|
||||||
COMMAND ${BASH} -c "
|
COMMAND ${BASH} -c "
|
||||||
|
TEST_CURL_CMD=\"${CURL_CMD} --header 'X-Forwarded-For: ${CTEST_HOST}, 127.0.0.1' --output /dev/null\"
|
||||||
for i in {0..10}; do
|
for i in {0..10}; do
|
||||||
if ! ${CURL_CMD} --header \"X-Forwarded-For: ${CTEST_HOST}, ${CTEST_HOST}\" --output /dev/null ${HTTPD1_URL}; then
|
if ! \${TEST_CURL_CMD} ${HTTPD1_URL}; then
|
||||||
echo \"${HTTPD1_URL}\";
|
echo \"${HTTPD1_URL}\";
|
||||||
fi
|
fi
|
||||||
if ! ${CURL_CMD} --header \"X-Forwarded-For: ${CTEST_HOST}, ${CTEST_HOST}\" --output /dev/null ${HTTPD2_URL}; then
|
if ! \${TEST_CURL_CMD} ${HTTPD2_URL}; then
|
||||||
echo \"${HTTPD2_URL}\";
|
echo \"${HTTPD2_URL}\";
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -977,6 +981,7 @@ foreach(DIRECTIVE_INDEX RANGE ${DIRECTIVES_LENGTH})
|
|||||||
HTTPD_OUTPUT=$(${HTTPD_EXECUTABLE} -e debug -f ${HTTPD_CONF} -t 2>&1)
|
HTTPD_OUTPUT=$(${HTTPD_EXECUTABLE} -e debug -f ${HTTPD_CONF} -t 2>&1)
|
||||||
if [ \"\${?}\" -eq \"0\" ]; then
|
if [ \"\${?}\" -eq \"0\" ]; then
|
||||||
echo \"Unexpected success.\"
|
echo \"Unexpected success.\"
|
||||||
|
echo \"\${HTTPD_OUTPUT}\"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
if echo \"\${HTTPD_OUTPUT}\" | ${GREP_EXECUTABLE} -q \"${DIRECTIVE_ERROR}\"; then
|
if echo \"\${HTTPD_OUTPUT}\" | ${GREP_EXECUTABLE} -q \"${DIRECTIVE_ERROR}\"; then
|
||||||
|
@ -88,8 +88,8 @@ Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/d
|
|||||||
ModTileMissingRequestTimeout 3
|
ModTileMissingRequestTimeout 3
|
||||||
ModTileRenderdSocketName @RENDERD2_SOCKET@
|
ModTileRenderdSocketName @RENDERD2_SOCKET@
|
||||||
ModTileRequestTimeout 3
|
ModTileRequestTimeout 3
|
||||||
ModTileThrottlingRenders 128 0.2
|
ModTileThrottlingRenders 1 0.2
|
||||||
ModTileThrottlingTiles 10000 1
|
ModTileThrottlingTiles 1 1
|
||||||
ModTileTileDir @TILE_DIR@
|
ModTileTileDir @TILE_DIR@
|
||||||
ModTileVeryOldThreshold -10000000
|
ModTileVeryOldThreshold -10000000
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
@ -53,7 +53,8 @@ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
|
|||||||
[@DEFAULT_MAP_NAME@_parameterization]
|
[@DEFAULT_MAP_NAME@_parameterization]
|
||||||
PARAMETERIZE_STYLE=language
|
PARAMETERIZE_STYLE=language
|
||||||
TILEDIR=@TILE_DIR@
|
TILEDIR=@TILE_DIR@
|
||||||
URI=/tiles/parameterization/
|
TYPE=png image/png# Test two parts (rather than three)
|
||||||
|
URI=/tiles/parameterization# Test no trailing slash
|
||||||
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
|
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
|
||||||
|
|
||||||
# Test Comment: JPEG Map Section
|
# Test Comment: JPEG Map Section
|
||||||
|
Reference in New Issue
Block a user