mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-07-25 15:04:30 +00:00
Added missing signal handlers (#364)
`renderd` coverage is otherwise not properly reported _Also:_ - Removed `freebsd12` from CI - Packages are no longer provided (http://pkg.freebsd.org/) - Added test for `HTCP host name` specification - Renamed files in `src`/`includes` to match target names - `src/daemon.c` → `src/renderd.c` - `src/speedtest.cpp` →`src/render_speedtest.cpp` - `includes/daemon.h` → `includes/renderd.h`
This commit is contained in:
1
.github/workflows/build-and-test.yml
vendored
1
.github/workflows/build-and-test.yml
vendored
@ -186,7 +186,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
box_generic:
|
box_generic:
|
||||||
- freebsd12
|
|
||||||
- freebsd13
|
- freebsd13
|
||||||
build_system:
|
build_system:
|
||||||
- CMake
|
- CMake
|
||||||
|
3
.github/workflows/coverage.yml
vendored
3
.github/workflows/coverage.yml
vendored
@ -34,9 +34,6 @@ jobs:
|
|||||||
- name: Test `mod_tile`
|
- name: Test `mod_tile`
|
||||||
uses: ./.github/actions/cmake/test
|
uses: ./.github/actions/cmake/test
|
||||||
|
|
||||||
- name: Test `mod_tile` again (to gather more coverage data)
|
|
||||||
uses: ./.github/actions/cmake/test
|
|
||||||
|
|
||||||
- name: Process `mod_tile` coverage results
|
- name: Process `mod_tile` coverage results
|
||||||
run: |
|
run: |
|
||||||
ctest -T coverage
|
ctest -T coverage
|
||||||
|
@ -37,7 +37,7 @@ man_MANS = \
|
|||||||
renderddir = $(sysconfdir)
|
renderddir = $(sysconfdir)
|
||||||
|
|
||||||
renderd_SOURCES = \
|
renderd_SOURCES = \
|
||||||
src/daemon.c \
|
src/renderd.c \
|
||||||
src/daemon_compat.c \
|
src/daemon_compat.c \
|
||||||
src/gen_tile.cpp \
|
src/gen_tile.cpp \
|
||||||
src/sys_utils.c \
|
src/sys_utils.c \
|
||||||
@ -52,7 +52,7 @@ renderd_LDADD = $(PTHREAD_CFLAGS) $(MAPNIK_LDFLAGS) $(STORE_LDFLAGS) $(INIPARSER
|
|||||||
renderd_DATA = etc/renderd/renderd.conf
|
renderd_DATA = etc/renderd/renderd.conf
|
||||||
|
|
||||||
render_speedtest_SOURCES = \
|
render_speedtest_SOURCES = \
|
||||||
src/speedtest.cpp \
|
src/render_speedtest.cpp \
|
||||||
src/protocol_helper.c \
|
src/protocol_helper.c \
|
||||||
src/render_submit_queue.c \
|
src/render_submit_queue.c \
|
||||||
src/sys_utils.c \
|
src/sys_utils.c \
|
||||||
@ -91,7 +91,7 @@ gen_tile_test_SOURCES = \
|
|||||||
src/metatile.cpp \
|
src/metatile.cpp \
|
||||||
src/request_queue.c \
|
src/request_queue.c \
|
||||||
src/protocol_helper.c \
|
src/protocol_helper.c \
|
||||||
src/daemon.c \
|
src/renderd.c \
|
||||||
src/daemon_compat.c \
|
src/daemon_compat.c \
|
||||||
src/gen_tile.cpp \
|
src/gen_tile.cpp \
|
||||||
src/sys_utils.c \
|
src/sys_utils.c \
|
||||||
|
@ -89,9 +89,13 @@
|
|||||||
#define REQUEST_TIMEOUT (3)
|
#define REQUEST_TIMEOUT (3)
|
||||||
#define FD_INVALID (-1)
|
#define FD_INVALID (-1)
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
#define MAX(x,y) ((x)>(y)?(x):(y))
|
#define MAX(x,y) ((x)>(y)?(x):(y))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_CONNECTIONS (2048)
|
#define MAX_CONNECTIONS (2048)
|
||||||
|
|
||||||
|
@ -15,8 +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/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DAEMON_H
|
#ifndef RENDERD_H
|
||||||
#define DAEMON_H
|
#define RENDERD_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
@ -143,8 +143,8 @@ target_link_libraries(render_old ${render_old_LIBS})
|
|||||||
set(render_speedtest_SRCS
|
set(render_speedtest_SRCS
|
||||||
${COMMON_SRCS}
|
${COMMON_SRCS}
|
||||||
protocol_helper.c
|
protocol_helper.c
|
||||||
|
render_speedtest.cpp
|
||||||
render_submit_queue.c
|
render_submit_queue.c
|
||||||
speedtest.cpp
|
|
||||||
)
|
)
|
||||||
set(render_speedtest_LIBS
|
set(render_speedtest_LIBS
|
||||||
${COMMON_LIBRARIES}
|
${COMMON_LIBRARIES}
|
||||||
@ -163,11 +163,11 @@ set(renderd_SRCS
|
|||||||
${STORE_SRCS}
|
${STORE_SRCS}
|
||||||
cache_expire.c
|
cache_expire.c
|
||||||
daemon_compat.c
|
daemon_compat.c
|
||||||
daemon.c
|
|
||||||
gen_tile.cpp
|
gen_tile.cpp
|
||||||
metatile.cpp
|
metatile.cpp
|
||||||
parameterize_style.cpp
|
parameterize_style.cpp
|
||||||
protocol_helper.c
|
protocol_helper.c
|
||||||
|
renderd.c
|
||||||
request_queue.c
|
request_queue.c
|
||||||
)
|
)
|
||||||
set(renderd_LIBS
|
set(renderd_LIBS
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "gen_tile.h"
|
#include "gen_tile.h"
|
||||||
#include "render_config.h"
|
#include "render_config.h"
|
||||||
#include "daemon.h"
|
#include "renderd.h"
|
||||||
#include "store.h"
|
#include "store.h"
|
||||||
#include "metatile.h"
|
#include "metatile.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
@ -357,7 +357,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (force || (s.size < 0) || (s.expired)) {
|
if (force || (s.size < 0) || (s.expired)) {
|
||||||
// missing or old, render it
|
// missing or old, render it
|
||||||
//ret = process_loop(fd, mapname, x, y, z);
|
|
||||||
enqueue(mapname, x, y, z);
|
enqueue(mapname, x, y, z);
|
||||||
num_render++;
|
num_render++;
|
||||||
|
|
||||||
|
@ -76,8 +76,6 @@ int foreground = 1;
|
|||||||
|
|
||||||
static double minmax(double a, double b, double c)
|
static double minmax(double a, double b, double c)
|
||||||
{
|
{
|
||||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
|
||||||
#define MAX(x,y) ((x)>(y)?(x):(y))
|
|
||||||
a = MAX(a, b);
|
a = MAX(a, b);
|
||||||
a = MIN(a, c);
|
a = MIN(a, c);
|
||||||
return a;
|
return a;
|
||||||
@ -136,54 +134,6 @@ void display_rate(struct timeval start, struct timeval end, int num)
|
|||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rx_process(const struct protocol *req)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "version(%d), cmd(%d), z(%d), x(%d), y(%d)\n",
|
|
||||||
req->ver, req->cmd, req->z, req->x, req->y);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int process_loop(int fd, int x, int y, int z, const char * map)
|
|
||||||
{
|
|
||||||
struct protocol cmd, rsp;
|
|
||||||
//struct pollfd fds[1];
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
bzero(&cmd, sizeof(cmd));
|
|
||||||
|
|
||||||
cmd.ver = 2;
|
|
||||||
cmd.cmd = cmdRender;
|
|
||||||
cmd.z = z;
|
|
||||||
cmd.x = x;
|
|
||||||
cmd.y = y;
|
|
||||||
strcpy(cmd.xmlname, map);
|
|
||||||
//strcpy(cmd.path, "/tmp/foo.png");
|
|
||||||
|
|
||||||
//printf("Sending request\n");
|
|
||||||
ret = send(fd, &cmd, sizeof(cmd), 0);
|
|
||||||
|
|
||||||
if (ret != sizeof(cmd)) {
|
|
||||||
perror("send error");
|
|
||||||
}
|
|
||||||
|
|
||||||
//printf("Waiting for response\n");
|
|
||||||
bzero(&rsp, sizeof(rsp));
|
|
||||||
ret = recv(fd, &rsp, sizeof(rsp), 0);
|
|
||||||
|
|
||||||
if (ret != sizeof(rsp)) {
|
|
||||||
perror("recv error");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//printf("Got response\n");
|
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
perror("Socket send error");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *spath = RENDERD_SOCKET;
|
const char *spath = RENDERD_SOCKET;
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "render_config.h"
|
#include "render_config.h"
|
||||||
#include "daemon.h"
|
#include "renderd.h"
|
||||||
#include "gen_tile.h"
|
#include "gen_tile.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "protocol_helper.h"
|
#include "protocol_helper.h"
|
||||||
@ -58,7 +58,7 @@
|
|||||||
#ifndef MAIN_ALREADY_DEFINED
|
#ifndef MAIN_ALREADY_DEFINED
|
||||||
static pthread_t *render_threads;
|
static pthread_t *render_threads;
|
||||||
static pthread_t *slave_threads;
|
static pthread_t *slave_threads;
|
||||||
static struct sigaction sigPipeAction;
|
static struct sigaction sigPipeAction, sigExitAction;
|
||||||
static pthread_t stats_thread;
|
static pthread_t stats_thread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1097,6 +1097,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = server_socket_init(&config);
|
fd = server_socket_init(&config);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
if (fcntl(fd, F_SETFD, O_RDWR | O_NONBLOCK) < 0) {
|
if (fcntl(fd, F_SETFD, O_RDWR | O_NONBLOCK) < 0) {
|
||||||
@ -1107,7 +1108,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//sigPipeAction.sa_handler = pipe_handler;
|
|
||||||
sigPipeAction.sa_handler = SIG_IGN;
|
sigPipeAction.sa_handler = SIG_IGN;
|
||||||
|
|
||||||
if (sigaction(SIGPIPE, &sigPipeAction, NULL) < 0) {
|
if (sigaction(SIGPIPE, &sigPipeAction, NULL) < 0) {
|
||||||
@ -1116,6 +1116,14 @@ int main(int argc, char **argv)
|
|||||||
exit(6);
|
exit(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sigExitAction.sa_handler = (void *) request_exit;
|
||||||
|
|
||||||
|
sigaction(SIGHUP, &sigExitAction, NULL);
|
||||||
|
|
||||||
|
sigaction(SIGINT, &sigExitAction, NULL);
|
||||||
|
|
||||||
|
sigaction(SIGTERM, &sigExitAction, NULL);
|
||||||
|
|
||||||
render_init(config.mapnik_plugins_dir, config.mapnik_font_dir, config.mapnik_font_dir_recurse);
|
render_init(config.mapnik_plugins_dir, config.mapnik_font_dir, config.mapnik_font_dir_recurse);
|
||||||
|
|
||||||
/* unless the command line said to run in foreground mode, fork and detach from terminal */
|
/* unless the command line said to run in foreground mode, fork and detach from terminal */
|
@ -4,6 +4,7 @@ font_dir_recurse=@MAPNIK_FONTS_DIR_RECURSE@
|
|||||||
plugins_dir=@MAPNIK_PLUGINS_DIR@
|
plugins_dir=@MAPNIK_PLUGINS_DIR@
|
||||||
|
|
||||||
[@DEFAULT_MAP_NAME@]
|
[@DEFAULT_MAP_NAME@]
|
||||||
|
HTCPHOST=@HTTPD0_HOST@
|
||||||
TILEDIR=@PROJECT_BINARY_DIR@/tests/tiles
|
TILEDIR=@PROJECT_BINARY_DIR@/tests/tiles
|
||||||
URI=/tiles/@DEFAULT_MAP_NAME@
|
URI=/tiles/@DEFAULT_MAP_NAME@
|
||||||
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
|
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
|
||||||
|
Reference in New Issue
Block a user