From: Joshua Colp Date: Fri, 31 Mar 2006 00:53:32 +0000 (+0000) Subject: Do not leave a thread in limbo if an error occurs, or if testing packet loss. X-Git-Tag: 1.4.0-beta1~2218 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5880a7f5136cdb10edc90f7074b3eeaf38b960f8;p=thirdparty%2Fasterisk.git Do not leave a thread in limbo if an error occurs, or if testing packet loss. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16617 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 67bfdea571..33c1406309 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -6558,11 +6558,12 @@ static int socket_read(int *id, int fd, short events, void *cbdata) if (errno != ECONNREFUSED) ast_log(LOG_WARNING, "Error: %s\n", strerror(errno)); handle_error(); + ASTOBJ_CONTAINER_LINK_END(&idlelist, thread); return 1; } - if(test_losspct) { /* simulate random loss condition */ - if( (100.0*rand()/(RAND_MAX+1.0)) < test_losspct) - return 1; + if (test_losspct && ((100.0*rand()/(RAND_MAX+1.0)) < test_losspct)) { /* simulate random loss condition */ + ASTOBJ_CONTAINER_LINK_END(&idlelist, thread); + return 1; } /* Mark as ready and send on its way */ thread->iostate = IAX_IOSTATE_READY;