From: Juho Vähä-Herttua Date: Wed, 28 Mar 2012 20:33:47 +0000 (+0300) Subject: Add raop_is_running function. X-Git-Tag: upstream/0.9.0~4^2~85 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5a746b97186cd50b3c787824ea2290dc88d84ed0;p=deb_shairplay.git Add raop_is_running function. --- diff --git a/src/include/raop.h b/src/include/raop.h index 01d03ea..e5158cb 100644 --- a/src/include/raop.h +++ b/src/include/raop.h @@ -26,6 +26,8 @@ typedef struct raop_callbacks_s raop_callbacks_t; RAOP_API raop_t *raop_init(raop_callbacks_t *callbacks, const char *pemkey); RAOP_API raop_t *raop_init_from_keyfile(raop_callbacks_t *callbacks, const char *keyfile); +RAOP_API int raop_is_running(raop_t *raop); + RAOP_API int raop_start(raop_t *raop, unsigned short *port, const char *hwaddr, int hwaddrlen, const char *password); RAOP_API void raop_stop(raop_t *raop); diff --git a/src/lib/httpd.c b/src/lib/httpd.c index 8a38443..0dbc847 100644 --- a/src/lib/httpd.c +++ b/src/lib/httpd.c @@ -336,6 +336,20 @@ httpd_start(httpd_t *httpd, unsigned short *port) return 1; } +int +httpd_is_running(httpd_t *httpd) +{ + int running; + + assert(httpd); + + MUTEX_LOCK(httpd->run_mutex); + running = httpd->running || !httpd->joined; + MUTEX_UNLOCK(httpd->run_mutex); + + return running; +} + void httpd_stop(httpd_t *httpd) { diff --git a/src/lib/httpd.h b/src/lib/httpd.h index ef9fecc..887778d 100644 --- a/src/lib/httpd.h +++ b/src/lib/httpd.h @@ -32,6 +32,8 @@ typedef struct httpd_callbacks_s httpd_callbacks_t; httpd_t *httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections, int use_rtsp); +int httpd_is_running(httpd_t *httpd); + int httpd_start(httpd_t *httpd, unsigned short *port); void httpd_stop(httpd_t *httpd); diff --git a/src/lib/raop.c b/src/lib/raop.c index 8ddb088..fe57735 100644 --- a/src/lib/raop.c +++ b/src/lib/raop.c @@ -429,6 +429,14 @@ raop_destroy(raop_t *raop) } } +int +raop_is_running(raop_t *raop) +{ + assert(raop); + + return httpd_is_running(raop->httpd); +} + int raop_start(raop_t *raop, unsigned short *port, const char *hwaddr, int hwaddrlen, const char *password) {