/* Close file */
if (im->mm_iptv_fd > 0) {
- udp_close(im->mm_iptv_connection); // removes from poll
+ tvhpoll_rem1(iptv_poll, im->mm_iptv_fd);
+ udp_close(im->mm_iptv_connection);
im->mm_iptv_connection = NULL;
im->mm_iptv_fd = -1;
}
/* Close file2 */
if (im->mm_iptv_fd2 > 0) {
- udp_close(im->mm_iptv_connection2); // removes from poll
+ tvhpoll_rem1(iptv_poll, im->mm_iptv_fd2);
+ udp_close(im->mm_iptv_connection2);
im->mm_iptv_connection2 = NULL;
im->mm_iptv_fd2 = -1;
}
#include "tvheadend.h"
#include "iptv_private.h"
#include "spawn.h"
+#include "tvhpoll.h"
#include <sys/socket.h>
#include <sys/types.h>
int rd = im->mm_iptv_fd;
pid_t pid = (intptr_t)im->im_data;
spawn_kill(pid, tvh_kill_to_sig(im->mm_iptv_kill), im->mm_iptv_kill_timeout);
- if (rd > 0)
+ if (rd > 0) {
+ tvhpoll_rem1(iptv_poll, rd);
close(rd);
+ }
im->mm_iptv_fd = -1;
}
continue;
}
if (r <= 0) {
+ tvhpoll_rem1(iptv_poll, rd);
close(rd);
pid = (intptr_t)im->im_data;
spawn_kill(pid, tvh_kill_to_sig(im->mm_iptv_kill), im->mm_iptv_kill_timeout);
#define IPTV_PKTS 32
#define IPTV_PKT_PAYLOAD 1472
-extern pthread_mutex_t iptv_lock;
-
typedef struct iptv_input iptv_input_t;
typedef struct iptv_network iptv_network_t;
typedef struct iptv_mux iptv_mux_t;
typedef struct iptv_service iptv_service_t;
typedef struct iptv_handler iptv_handler_t;
+typedef struct tvhpoll tvhpoll_t;
+
struct iptv_handler
{
const char *scheme;
extern iptv_input_t *iptv_input;
extern iptv_network_t *iptv_network;
+extern pthread_mutex_t iptv_lock;
+extern tvhpoll_t *iptv_poll;
int iptv_url_set ( char **url, char **sane_url, const char *str, int allow_file, int allow_pipe );