terminate correctly statically created tasks

This commit is contained in:
philippe44
2019-11-05 20:18:26 -08:00
parent 3304571312
commit 0f8bd30544
5 changed files with 13 additions and 17 deletions

View File

@@ -185,9 +185,6 @@ struct raop_ctx_s *raop_create(struct in_addr host, char *name,
#ifdef WIN32
// seems that Windows snprintf does not add NULL char if actual size > max
id[63] = '\0';
ctx->svc = mdnsd_register_svc(ctx->svr, id, "_raop._tcp.local", ctx->port, NULL, (const char**) txt);
pthread_create(&ctx->thread, NULL, &rtsp_thread, ctx);
ctx->svc = mdnsd_register_svc(ctx->svr, id, "_raop._tcp.local", ctx->port, NULL, (const char**) txt);
pthread_create(&ctx->thread, NULL, &rtsp_thread, ctx);
@@ -221,6 +218,7 @@ void raop_delete(struct raop_ctx_s *ctx) {
// wake-up thread by connecting socket, needed for freeBSD
sock = socket(AF_INET, SOCK_STREAM, 0);
getsockname(ctx->sock, (struct sockaddr *) &addr, &nlen);
connect(sock, (struct sockaddr*) &addr, sizeof(addr));
closesocket(sock);
#ifdef WIN32
@@ -369,7 +367,7 @@ static void *rtsp_thread(void *arg) {
if (n > 0) res = handle_rtsp(ctx, sock);
if (n < 0 || !res) {
closesocket(sock);
closesocket(sock);
LOG_INFO("RTSP close %u", sock);
sock = -1;
}