Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
capmt: simlify locking in capmt_thread
  • Loading branch information
perexg committed Nov 8, 2015
1 parent 4085ac2 commit 2a9cea2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/descrambler/capmt.c
Expand Up @@ -1688,16 +1688,17 @@ capmt_thread(void *aux)
pthread_mutex_unlock(&capmt->capmt_mutex);
continue;
}
pthread_mutex_unlock(&capmt->capmt_mutex);

/* close opened sockets */
for (i = 0; i < MAX_SOCKETS; i++)
capmt_socket_close_lock(capmt, i);
for (i = 0; i < MAX_CA; i++)
capmt_socket_close(capmt, i);

/* close all tuners */
for (i = 0; i < MAX_CA; i++) {
if (capmt->capmt_adapters[i].ca_sock >= 0)
close(capmt->capmt_adapters[i].ca_sock);

pthread_mutex_lock(&capmt->capmt_mutex);
capmt->capmt_adapters[i].ca_tuner = NULL;
}

if (!capmt->capmt_running) {
pthread_mutex_unlock(&capmt->capmt_mutex);
Expand All @@ -1711,8 +1712,8 @@ capmt_thread(void *aux)
d = 60;
}

ts.tv_sec = time(NULL) + d;
ts.tv_nsec = 0;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += d;

tvhlog(LOG_INFO, "capmt", "%s: Automatic reconnection attempt in in %d seconds", idnode_get_title(&capmt->cac_id, NULL), d);

Expand Down

0 comments on commit 2a9cea2

Please sign in to comment.