Skip to content

Commit

Permalink
Close mountpoint ports when leaving relay thread (fixes #3111) (#3143)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Jan 11, 2023
1 parent dc353f9 commit 053b50b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -9316,6 +9316,25 @@ static void *janus_streaming_relay_thread(void *data) {
}
}

/* Close the ports we bound to */
temp = source->media;
while(temp) {
janus_streaming_rtp_source_stream *stream = (janus_streaming_rtp_source_stream *)temp->data;
if(stream->fd[0] > -1)
close(stream->fd[0]);
stream->fd[0] = -1;
if(stream->fd[1] > -1)
close(stream->fd[1]);
stream->fd[1] = -1;
if(stream->fd[2] > -1)
close(stream->fd[2]);
stream->fd[2] = -1;
if(stream->rtcp_fd > -1)
close(stream->rtcp_fd);
stream->rtcp_fd = -1;
temp = temp->next;
}

/* Notify users this mountpoint is done */
janus_mutex_lock(&mountpoint->mutex);
GList *viewer = g_list_first(mountpoint->viewers);
Expand Down

0 comments on commit 053b50b

Please sign in to comment.