TT#14008 fix poller-per-thread behaviour

Change-Id: Ie75e9ebb315801157e432b2d0ce6a07c61cdd0d0
pull/1430/head
Richard Fuchs 4 years ago
parent 4c2c50d13e
commit 31e41d1282

@ -3220,7 +3220,8 @@ static void __call_cleanup(struct call *c) {
while (c->stream_fds.head) { while (c->stream_fds.head) {
struct stream_fd *sfd = g_queue_pop_head(&c->stream_fds); struct stream_fd *sfd = g_queue_pop_head(&c->stream_fds);
poller_del_item(rtpe_poller, sfd->socket.fd); if (sfd->poller)
poller_del_item(sfd->poller, sfd->socket.fd);
obj_put(sfd); obj_put(sfd);
} }

@ -1232,7 +1232,7 @@ int main(int argc, char **argv) {
thread_create_detach_prio(poller_loop, rtpe_poller_map, rtpe_config.scheduling, rtpe_config.priority, "poller"); thread_create_detach_prio(poller_loop, rtpe_poller_map, rtpe_config.scheduling, rtpe_config.priority, "poller");
} }
if (!rtpe_config.poller_per_thread) if (rtpe_config.poller_per_thread)
thread_create_detach_prio(poller_loop2, rtpe_poller, rtpe_config.scheduling, rtpe_config.priority, "poller"); thread_create_detach_prio(poller_loop2, rtpe_poller, rtpe_config.scheduling, rtpe_config.priority, "poller");
if (rtpe_config.media_num_threads < 0) if (rtpe_config.media_num_threads < 0)

@ -805,10 +805,9 @@ static void release_port(socket_t *r, struct intf_spec *spec) {
__C_DBG("trying to release port %u", port); __C_DBG("trying to release port %u", port);
iptables_del_rule(r);
if (close_socket(r) == 0) { if (close_socket(r) == 0) {
__C_DBG("port %u is released", port); __C_DBG("port %u is released", port);
iptables_del_rule(r);
bit_array_clear(pp->ports_used, port); bit_array_clear(pp->ports_used, port);
g_atomic_int_inc(&pp->free_ports); g_atomic_int_inc(&pp->free_ports);
if ((port & 1) == 0) { if ((port & 1) == 0) {
@ -2659,6 +2658,7 @@ struct stream_fd *stream_fd_new(socket_t *fd, struct call *call, const struct lo
if (p) { if (p) {
if (poller_add_item(p, &pi)) if (poller_add_item(p, &pi))
ilog(LOG_ERR, "Failed to add stream_fd to poller"); ilog(LOG_ERR, "Failed to add stream_fd to poller");
sfd->poller = p;
} }
return sfd; return sfd;

@ -384,10 +384,6 @@ int poller_poll(struct poller *p, int timeout) {
mutex_lock(&p->lock); mutex_lock(&p->lock);
ret = -1;
if (!p->items || !p->items_size)
goto out;
mutex_unlock(&p->lock); mutex_unlock(&p->lock);
errno = 0; errno = 0;
ret = epoll_wait(p->fd, evs, sizeof(evs) / sizeof(*evs), timeout); ret = epoll_wait(p->fd, evs, sizeof(evs) / sizeof(*evs), timeout);

@ -21,6 +21,8 @@ struct transport_protocol;
struct ssrc_ctx; struct ssrc_ctx;
struct rtpengine_srtp; struct rtpengine_srtp;
struct jb_packet; struct jb_packet;
struct stream_fd;
struct poller;
typedef int rtcp_filter_func(struct media_packet *, GQueue *); typedef int rtcp_filter_func(struct media_packet *, GQueue *);
typedef int (*rewrite_func)(str *, struct packet_stream *, struct stream_fd *, const endpoint_t *, typedef int (*rewrite_func)(str *, struct packet_stream *, struct stream_fd *, const endpoint_t *,
@ -123,6 +125,7 @@ struct stream_fd {
struct crypto_context crypto; /* IN direction, LOCK: stream->in_lock */ struct crypto_context crypto; /* IN direction, LOCK: stream->in_lock */
struct dtls_connection dtls; /* LOCK: stream->in_lock */ struct dtls_connection dtls; /* LOCK: stream->in_lock */
int error_strikes; int error_strikes;
struct poller *poller;
}; };
struct sink_handler { struct sink_handler {
struct packet_stream *sink; struct packet_stream *sink;

Loading…
Cancel
Save