[asterisk-dev] ast_read and frames of type AST_FRAME_NULL?

Klaus Darilion klaus.mailinglists at pernau.at
Fri Jun 25 03:35:16 CDT 2010


I think this thread can be interesting for you:
http://www.mail-archive.com/asterisk-dev@lists.digium.com/msg37785.html

regards
Klaus

Am 24.06.2010 17:15, schrieb Bryan Field-Elliot:
> OK here's a follow-on question:
>
> I've altered my code, such that if ast_waitfor returns 0, it loops around and basically issues another ast_waitfor.
>
> My ms waitfor time is now 200. Simplified code below:
>
> int empty_counter = 0;
> for (;;) {
> 	r = ast_waitfor(chan, 200);
> 	if (r == 0) {
> 		empty_counter++;
> 		continue;
> 	}
> 	frame = ast_read(chan);
> 	// ... do some work
> 	// how long did we wait?
> 	ast_verb(4, "waitfor returned empty %d times\n", empty_counter);
> }
>
> I'm finding that the empty_counter is climbing into the tens and sometimes hundreds of thousands. This shouldn't be possible if it's waiting 200ms each time. So my follow-on question is -- is there some state that channels might get in, such that ast_waitfor will return immediately rathe than waiting the number of milliseconds specified in its second parameter?
>
>
>
>
>
> On Jun 22, 2010, at 11:17 PM, Russell Bryant wrote:
>
>
> ----- Original Message -----
>> I think Russell means you're only supposed to call ast_read() if r>
>> 0, not if r == 0. Other places in the code (like app_waitforring.c and
>> app_meetme.c) seem to follow this convention.
>
> Correct.
>
> --
> Russell Bryant
> Digium, Inc.  |  Engineering Manager, Open Source Software
> 445 Jan Davis Drive NW   -    Huntsville, AL 35806  -  USA
> jabber: rbryant at digium.com    -=-    skype: russell-bryant
> www.digium.com -=- www.asterisk.org -=- blogs.asterisk.org
>



More information about the asterisk-dev mailing list