From f4dfee0e9f6e27c4b49532344380163a1b3e148b Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 11 Nov 2014 11:24:19 +0800 Subject: [PATCH 1/2] research st, add comments for bug #193. --- trunk/research/st/event.c | 2 ++ trunk/research/st/srs.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/trunk/research/st/event.c b/trunk/research/st/event.c index b824bc364..9747ee876 100644 --- a/trunk/research/st/event.c +++ b/trunk/research/st/event.c @@ -308,6 +308,8 @@ ST_HIDDEN void _st_epoll_dispatch(void) timeout = (int) (min_timeout / 1000); } + // TODO: WINLIN: remove it for bug introduced. + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/193 if (_st_epoll_data->pid != getpid()) { /* We probably forked, reinitialize epoll set */ close(_st_epoll_data->epfd); diff --git a/trunk/research/st/srs.c b/trunk/research/st/srs.c index 6b9cb9346..fea655509 100644 --- a/trunk/research/st/srs.c +++ b/trunk/research/st/srs.c @@ -52,8 +52,8 @@ int sleep_test() srs_trace("sleep test: start"); srs_trace("1. sleep..."); - st_usleep(sleep_ms * 1000); + srs_trace("2. sleep ok"); srs_trace("sleep test: end"); From be46e428ada0f21ec44feee800de90e846e9bcbc Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 11 Nov 2014 11:25:52 +0800 Subject: [PATCH 2/2] research st, for bug #193, remove the code with bug, exit when fork. --- trunk/research/st/event.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/trunk/research/st/event.c b/trunk/research/st/event.c index 9747ee876..439c8fa9f 100644 --- a/trunk/research/st/event.c +++ b/trunk/research/st/event.c @@ -308,26 +308,10 @@ ST_HIDDEN void _st_epoll_dispatch(void) timeout = (int) (min_timeout / 1000); } - // TODO: WINLIN: remove it for bug introduced. - // @see: https://github.com/winlinvip/simple-rtmp-server/issues/193 if (_st_epoll_data->pid != getpid()) { - /* We probably forked, reinitialize epoll set */ - close(_st_epoll_data->epfd); - _st_epoll_data->epfd = epoll_create(_st_epoll_data->fd_hint); - if (_st_epoll_data->epfd < 0) { - /* There is nothing we can do here, will retry later */ - return; - } - fcntl(_st_epoll_data->epfd, F_SETFD, FD_CLOEXEC); - _st_epoll_data->pid = getpid(); - - /* Put all descriptors on ioq into new epoll set */ - memset(_st_epoll_data->fd_data, 0, _st_epoll_data->fd_data_size * sizeof(_epoll_fd_data_t)); - _st_epoll_data->evtlist_cnt = 0; - for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) { - pq = _ST_POLLQUEUE_PTR(q); - _st_epoll_pollset_add(pq->pds, pq->npds); - } + // WINLIN: remove it for bug introduced. + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/193 + exit(-1); } /* Check for I/O operations */