From 5fd120baec927bbb293e2a59292a748a8e11b533 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 17 Feb 2016 15:43:51 -0800 Subject: [PATCH] Move some initialization closer to the client. --- adsbus.c | 5 +---- client.c | 5 +++++ client.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/adsbus.c b/adsbus.c index 67d5fd2..3430a21 100644 --- a/adsbus.c +++ b/adsbus.c @@ -1,9 +1,7 @@ -#include #include #include #include #include -#include #include "common.h" #include "backend.h" @@ -126,11 +124,10 @@ static bool parse_opts(int argc, char *argv[]) { } int main(int argc, char *argv[]) { - signal(SIGPIPE, SIG_IGN); - server_init(); peer_init(); hex_init(); + client_init(); airspy_adsb_init(); beast_init(); json_init(); diff --git a/client.c b/client.c index c6fc41e..5617d03 100644 --- a/client.c +++ b/client.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "common.h" #include "json.h" @@ -38,6 +39,10 @@ struct serializer { #define NUM_SERIALIZERS (sizeof(serializers) / sizeof(*serializers)) +void client_init() { + signal(SIGPIPE, SIG_IGN); +} + static void client_hangup(struct client *client) { fprintf(stderr, "C %s (%s): Client disconnected\n", client->id, client->serializer->name); if (client->prev) { diff --git a/client.h b/client.h index 86eb521..70653b2 100644 --- a/client.h +++ b/client.h @@ -3,6 +3,7 @@ #include "common.h" +void client_init(); struct serializer *client_get_serializer(char *); void client_add(int, struct serializer *); void client_add_wrapper(int, void *);