Skip to content

Commit

Permalink
Close mountpoint sockets when leaving relay thread (see #3143, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Jan 11, 2023
1 parent aa6560f commit 17d5382
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -8402,6 +8402,44 @@ static void *janus_streaming_relay_thread(void *data) {
}
}

/* Close the ports we bound to */
if(source->audio_fd > -1) {
close(source->audio_fd);
source->audio_fd = -1;
}
if(source->video_fd[0] > -1) {
close(source->video_fd[0]);
source->video_fd[0] = -1;
}
if(source->video_fd[1] > -1) {
close(source->video_fd[1]);
source->video_fd[1] = -1;
}
if(source->video_fd[2] > -1) {
close(source->video_fd[2]);
source->video_fd[2] = -1;
}
if(source->data_fd > -1) {
close(source->data_fd);
source->data_fd = -1;
}
if(source->audio_rtcp_fd > -1) {
close(source->audio_rtcp_fd);
source->audio_rtcp_fd = -1;
}
if(source->video_rtcp_fd > -1) {
close(source->video_rtcp_fd);
source->video_rtcp_fd = -1;
}
if(source->pipefd[0] > -1) {
close(source->pipefd[0]);
source->pipefd[0] = -1;
}
if(source->pipefd[1] > -1) {
close(source->pipefd[1]);
source->pipefd[1] = -1;
}

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

0 comments on commit 17d5382

Please sign in to comment.