mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add comments for #161
This commit is contained in:
parent
4af2e78c59
commit
77cf885d8c
3 changed files with 53 additions and 2 deletions
|
@ -64,6 +64,47 @@ int sleep_test()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void* sleep2_func0(void* arg)
|
||||
{
|
||||
int sleep_ms = 100;
|
||||
st_utime_t start = st_utime();
|
||||
st_usleep(sleep_ms * 1000);
|
||||
st_utime_t end = st_utime();
|
||||
|
||||
srs_trace("sleep ok, sleep=%dus, deviation=%dus",
|
||||
(int)(sleep_ms * 1000), (int)(end - start - sleep_ms * 1000));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* sleep2_func1(void* arg)
|
||||
{
|
||||
int sleep_ms = 250;
|
||||
st_utime_t start = st_utime();
|
||||
st_usleep(sleep_ms * 1000);
|
||||
st_utime_t end = st_utime();
|
||||
|
||||
srs_trace("sleep ok, sleep=%dus, deviation=%dus",
|
||||
(int)(sleep_ms * 1000), (int)(end - start - sleep_ms * 1000));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int sleep2_test()
|
||||
{
|
||||
srs_trace("===================================================");
|
||||
srs_trace("sleep2 test: start");
|
||||
|
||||
st_thread_t trd0 = st_thread_create(sleep2_func0, NULL, 1, 0);
|
||||
st_thread_t trd1 = st_thread_create(sleep2_func1, NULL, 1, 0);
|
||||
st_thread_join(trd0, NULL);
|
||||
st_thread_join(trd1, NULL);
|
||||
|
||||
srs_trace("sleep test: end");
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
st_mutex_t sleep_work_cond = NULL;
|
||||
void* sleep_deviation_func(void* arg)
|
||||
{
|
||||
|
@ -400,8 +441,8 @@ int main(int argc, char** argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (huge_stack_test() < 0) {
|
||||
srs_trace("huge_stack_test failed");
|
||||
if (sleep2_test() < 0) {
|
||||
srs_trace("sleep2_test failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -415,6 +456,11 @@ int main(int argc, char** argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (huge_stack_test() < 0) {
|
||||
srs_trace("huge_stack_test failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (thread_test() < 0) {
|
||||
srs_trace("thread_test failed");
|
||||
return -1;
|
||||
|
|
|
@ -534,6 +534,10 @@ int SrsRtmpConn::playing(SrsSource* source)
|
|||
// it's ok, do nothing.
|
||||
ret = ERROR_SUCCESS;
|
||||
srs_verbose("recv timeout, ignore. ret=%d", ret);
|
||||
|
||||
// TODO: FIXME: the timeout may caused some dead loop.
|
||||
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/161
|
||||
st_usleep(0);
|
||||
} else if (ret != ERROR_SUCCESS) {
|
||||
if (!srs_is_client_gracefully_close(ret)) {
|
||||
srs_error("recv client control message failed. ret=%d", ret);
|
||||
|
|
|
@ -48,6 +48,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// signal defines.
|
||||
#define SIGNAL_RELOAD SIGHUP
|
||||
|
||||
// nginx also set to 512
|
||||
#define SERVER_LISTEN_BACKLOG 512
|
||||
|
||||
// system interval in ms,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue