tcp_connection_launch
(int fd, void (*status) (void *opaque, htsmsg_t *m), access_t *aa)
{
- tcp_server_launch_t *tsl, *res = NULL;
+ tcp_server_launch_t *tsl, *res;
uint32_t used = 0;
time_t started = dispatch_clock;
return NULL;
try_again:
+ res = NULL;
LIST_FOREACH(tsl, &tcp_server_active, alink) {
if (tsl->fd == fd) {
res = tsl;
if (!strcmp(aa->aa_representative ?: "", tsl->representative ?: ""))
used++;
}
+ if (res == NULL)
+ return NULL;
if (aa->aa_conn_limit && used >= aa->aa_conn_limit) {
if (started + 3 < dispatch_clock) {
if (ev.data.ptr == &tcp_server_pipe) {
r = read(tcp_server_pipe.rd, &c, 1);
if (r > 0) {
+next:
pthread_mutex_lock(&global_lock);
while ((tsl = LIST_FIRST(&tcp_server_join)) != NULL) {
LIST_REMOVE(tsl, jlink);
pthread_mutex_unlock(&global_lock);
pthread_join(tsl->tid, NULL);
free(tsl);
- pthread_mutex_lock(&global_lock);
+ goto next;
}
pthread_mutex_unlock(&global_lock);
}