diff --git a/daemon/call.c b/daemon/call.c index dc06d2de0..e37ab4f2a 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -668,8 +668,8 @@ static int __media_want_interfaces(struct call_media *media) { } static void __endpoint_map_truncate(struct endpoint_map *em, unsigned int num_intfs) { while (em->intf_sfds.length > num_intfs) { - struct intf_list *il = g_queue_pop_tail(&em->intf_sfds); - free_release_intf_list(il); + struct sfd_intf_list *il = g_queue_pop_tail(&em->intf_sfds); + free_sfd_intf_list(il); } } static struct endpoint_map *__hunt_endpoint_map(struct call_media *media, unsigned int num_ports, @@ -683,7 +683,7 @@ static struct endpoint_map *__hunt_endpoint_map(struct call_media *media, unsign // any of our sockets shut down? for (GList *k = em->intf_sfds.head; k; k = k->next) { - struct intf_list *il = k->data; + struct sfd_intf_list *il = k->data; for (GList *j = il->list.head; j; j = j->next) { struct stream_fd *sfd = j->data; if (sfd->socket.fd == -1) @@ -742,7 +742,7 @@ static struct endpoint_map *__latch_endpoint_map(struct call_media *media) struct endpoint_map *em = l->data; if (!em->intf_sfds.length) continue; - struct intf_list *em_il = em->intf_sfds.head->data; + struct sfd_intf_list *em_il = em->intf_sfds.head->data; if (!em_il->list.length) continue; struct stream_fd *first = em_il->list.head->data; @@ -797,12 +797,12 @@ static struct endpoint_map *__get_endpoint_map(struct call_media *media, unsigne __C_DBG("allocating stream_fds for %u ports", num_ports); - struct intf_list *il; + struct socket_intf_list *il; while ((il = g_queue_pop_head(&intf_sockets))) { if (il->list.length != num_ports) goto next_il; - struct intf_list *em_il = g_slice_alloc0(sizeof(*em_il)); + struct sfd_intf_list *em_il = g_slice_alloc0(sizeof(*em_il)); em_il->local_intf = il->local_intf; g_queue_push_tail(&em->intf_sfds, em_il); @@ -839,7 +839,7 @@ static void __assign_stream_fds(struct call_media *media, GQueue *intf_sfds) { struct stream_fd *intf_sfd = NULL; for (GList *l = intf_sfds->head; l; l = l->next) { - struct intf_list *il = l->data; + struct sfd_intf_list *il = l->data; struct stream_fd *sfd = g_queue_peek_nth(&il->list, ps->component - 1); if (!sfd) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 16e1a071d..f4d793aff 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1213,7 +1213,7 @@ fail: int get_consecutive_ports(GQueue *out, unsigned int num_ports, unsigned int num_intfs, struct call_media *media) { GList *l; - struct intf_list *il; + struct socket_intf_list *il; struct local_intf *loc; const struct logical_intf *log = media->logical_intf; const str *label = &media->call->callid; /* call's callid */ @@ -1261,18 +1261,18 @@ error_ports: return -1; } -void free_socket_intf_list(struct intf_list *il) { +void free_socket_intf_list(struct socket_intf_list *il) { socket_t *sock; while ((sock = g_queue_pop_head(&il->list))) free_port(sock, il->local_intf->spec); g_slice_free1(sizeof(*il), il); } -void free_intf_list(struct intf_list *il) { +void free_intf_list(struct socket_intf_list *il) { g_queue_clear(&il->list); g_slice_free1(sizeof(*il), il); } -void free_release_intf_list(struct intf_list *il) { +void free_sfd_intf_list(struct sfd_intf_list *il) { g_queue_clear_full(&il->list, (GDestroyNotify) stream_fd_release); g_slice_free1(sizeof(*il), il); } diff --git a/daemon/redis.c b/daemon/redis.c index de88519ba..64b42ecaf 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1865,7 +1865,7 @@ static int json_link_medias(struct call *c, struct redis_list *medias, static int rbl_cb_intf_sfds(str *s, callback_arg_t qp, struct redis_list *list, void *ptr) { GQueue *q = qp.q; int i; - struct intf_list *il; + struct sfd_intf_list *il; struct endpoint_map *em; void *sfd; @@ -2662,7 +2662,7 @@ char* redis_encode_json(struct call *c) { json_builder_set_member_name(builder, tmp); json_builder_begin_array(builder); for (GList *m = ep->intf_sfds.head; m; m = m->next) { - struct intf_list *il = m->data; + struct sfd_intf_list *il = m->data; JSON_ADD_STRING("loc-%u", il->local_intf->unique_id); for (GList *n = il->list.head; n; n = n->next) { struct stream_fd *sfd = n->data; diff --git a/include/call.h b/include/call.h index 5c1321836..12ca96844 100644 --- a/include/call.h +++ b/include/call.h @@ -347,7 +347,7 @@ struct endpoint_map { struct endpoint endpoint; unsigned int num_ports; const struct logical_intf *logical_intf; - GQueue intf_sfds; /* list of struct intf_list - contains stream_fd list */ + GQueue intf_sfds; /* list of struct sfd_intf_list - contains stream_fd list */ unsigned int wildcard:1; }; diff --git a/include/media_socket.h b/include/media_socket.h index 7979e5cb2..88814a2cf 100644 --- a/include/media_socket.h +++ b/include/media_socket.h @@ -191,7 +191,11 @@ struct local_intf { struct interface_stats_block stats; }; -struct intf_list { +struct socket_intf_list { + struct local_intf *local_intf; + GQueue list; +}; +struct sfd_intf_list { struct local_intf *local_intf; GQueue list; }; @@ -306,10 +310,9 @@ void stream_fd_release(struct stream_fd *); enum thread_looper_action release_closed_sockets(void); void append_thread_lpr_to_glob_lpr(void); -void free_intf_list(struct intf_list *il); -void free_release_intf_list(struct intf_list *il); -void free_release_intf_list(struct intf_list *il); -void free_socket_intf_list(struct intf_list *il); +void free_intf_list(struct socket_intf_list *il); +void free_sfd_intf_list(struct sfd_intf_list *il); +void free_socket_intf_list(struct socket_intf_list *il); INLINE int open_intf_socket(socket_t *r, unsigned int port, const struct local_intf *lif) { return open_socket(r, SOCK_DGRAM, port, &lif->spec->local_address.addr);